mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-16 17:52:29 +02:00
fix(v2): improve dx sidebar config, ability to have no sidebars file (#4775)
* Improve sidebar config * Edit message * fix some little issues in the way undefined/false sidebars are handled * remove old error message as it has been moved to a better place Co-authored-by: Nam Hoang Le <nam.hoang.le@mgm-tp.com> Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
e85ec1ab12
commit
1ab8aa0af8
10 changed files with 235 additions and 129 deletions
|
@ -118,8 +118,7 @@ export default function pluginContentDocs(
|
|||
|
||||
getPathsToWatch() {
|
||||
function getVersionPathsToWatch(version: VersionMetadata): string[] {
|
||||
return [
|
||||
version.sidebarFilePath,
|
||||
const result = [
|
||||
...flatten(
|
||||
options.include.map((pattern) =>
|
||||
getDocsDirPaths(version).map(
|
||||
|
@ -129,6 +128,10 @@ export default function pluginContentDocs(
|
|||
),
|
||||
`${version.contentPath}/**/${CategoryMetadataFilenamePattern}`,
|
||||
];
|
||||
if (typeof version.sidebarFilePath === 'string') {
|
||||
result.unshift(version.sidebarFilePath);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return flatten(versionsMetadata.map(getVersionPathsToWatch));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue