mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-29 17:07:08 +02:00
v2: prepare to move
This commit is contained in:
parent
dc7ef96849
commit
45736200b0
172 changed files with 0 additions and 0 deletions
20
v2/lib/load/theme.js
Normal file
20
v2/lib/load/theme.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function loadConfig(siteDir) {
|
||||
const customThemePath = path.resolve(siteDir, 'theme');
|
||||
const themePath = fs.existsSync(customThemePath)
|
||||
? customThemePath
|
||||
: path.resolve(__dirname, '../theme');
|
||||
|
||||
const themeComponents = ['Docs', 'Loading', 'NotFound', 'Markdown'];
|
||||
themeComponents.forEach(component => {
|
||||
if (!require.resolve(path.join(themePath, component))) {
|
||||
throw new Error(
|
||||
`Failed to load ${themePath}/${component}. It does not exist.`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return themePath;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue