mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-29 00:47:03 +02:00
feat(v2): allow plugins to specify paths to watch (#1272)
This commit is contained in:
parent
8629abf73a
commit
cefee2dec1
6 changed files with 27 additions and 14 deletions
|
@ -5,6 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const _ = require('lodash');
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const chalk = require('chalk');
|
||||
|
@ -46,10 +47,14 @@ module.exports = async function start(siteDir, cliOptions = {}) {
|
|||
console.error(chalk.red(err.stack));
|
||||
});
|
||||
};
|
||||
const {plugins} = props;
|
||||
const docsRelativeDir = props.siteConfig.customDocsPath;
|
||||
const pluginPaths = _.flatten(
|
||||
plugins.map(plugin => plugin.getPathsToWatch()),
|
||||
);
|
||||
const fsWatcher = chokidar.watch(
|
||||
[
|
||||
// TODO: Watch plugin paths (e.g. blog)
|
||||
...pluginPaths,
|
||||
`../${docsRelativeDir}/**/*.md`,
|
||||
loadConfig.configFileName,
|
||||
'sidebars.json',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue