mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-03 04:07:32 +02:00
* feat(v2): implement blog * expect flat blog structure * \n * blogpage can import many posts
28 lines
664 B
JavaScript
28 lines
664 B
JavaScript
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 = [
|
|
'Doc',
|
|
'BlogPost',
|
|
'BlogPage',
|
|
'Pages',
|
|
'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;
|
|
};
|