fix: blog file should trigger reload

This commit is contained in:
endiliey 2018-08-05 19:51:08 +08:00
parent 221023fd51
commit dc1e417db8
4 changed files with 38 additions and 14 deletions

View file

@ -31,10 +31,14 @@ module.exports = async function start(siteDir, cliOptions = {}) {
console.error(chalk.red(err.stack));
});
};
const fsWatcher = chokidar.watch(['../docs/**/*.md', 'siteConfig.js'], {
cwd: siteDir,
ignoreInitial: true
});
const docsRelativeDir = props.siteConfig.customDocsPath || 'docs';
const fsWatcher = chokidar.watch(
[`../${docsRelativeDir}/**/*.md`, 'blog/**/*.md', 'siteConfig.js'],
{
cwd: siteDir,
ignoreInitial: true
}
);
fsWatcher.on('add', reload);
fsWatcher.on('change', reload);
fsWatcher.on('unlink', reload);