mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-21 03:57:51 +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
|
@ -34,14 +34,19 @@ class DocusaurusContentBlogPlugin {
|
|||
constructor(opts, context) {
|
||||
this.options = {...DEFAULT_OPTIONS, ...opts};
|
||||
this.context = context;
|
||||
this.contentPath = path.resolve(this.context.siteDir, this.options.path);
|
||||
}
|
||||
|
||||
getName() {
|
||||
return 'docusaurus-plugin-content-blog';
|
||||
}
|
||||
|
||||
async loadContents() {
|
||||
const {pageCount, path: filePath, include, routeBasePath} = this.options;
|
||||
const {env, siteConfig, siteDir} = this.context;
|
||||
const blogDir = path.resolve(siteDir, filePath);
|
||||
const {baseUrl} = siteConfig;
|
||||
const {pageCount, include, routeBasePath} = this.options;
|
||||
const {env, siteConfig} = this.context;
|
||||
const blogDir = this.contentPath;
|
||||
|
||||
const {baseUrl} = siteConfig;
|
||||
const blogFiles = await globby(include, {
|
||||
cwd: blogDir,
|
||||
});
|
||||
|
@ -127,6 +132,10 @@ class DocusaurusContentBlogPlugin {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
getPathsToWatch() {
|
||||
return [this.contentPath];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DocusaurusContentBlogPlugin;
|
Loading…
Add table
Add a link
Reference in a new issue