mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +02:00
feat: add siteConfig loader
This commit is contained in:
parent
06faff3474
commit
94c45e36cb
11 changed files with 4726 additions and 51 deletions
14
lib/loader/config.js
Normal file
14
lib/loader/config.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function loadConfig(sourceDir, deleteCache = true) {
|
||||
const configPath = path.resolve(sourceDir, '.blogi', 'config.js');
|
||||
if (deleteCache) {
|
||||
delete require.cache[configPath];
|
||||
}
|
||||
let config = {};
|
||||
if (fs.existsSync(configPath)) {
|
||||
config = require(configPath);
|
||||
}
|
||||
return config;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue