https://github.com/omar2535/vuepress-sidebar-children-autogenerator
NPM library to auto generate sidebar children in Vuepress
https://github.com/omar2535/vuepress-sidebar-children-autogenerator
npm sidebar-children sidebar-navigation vuepress vuepress-plugin
Last synced: 3 months ago
JSON representation
NPM library to auto generate sidebar children in Vuepress
- Host: GitHub
- URL: https://github.com/omar2535/vuepress-sidebar-children-autogenerator
- Owner: omar2535
- License: mit
- Created: 2020-03-14T03:49:05.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-11T23:32:32.000Z (over 1 year ago)
- Last Synced: 2025-04-06T08:49:50.631Z (3 months ago)
- Topics: npm, sidebar-children, sidebar-navigation, vuepress, vuepress-plugin
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@omar2535/vuepress-sidebar-children-autogenerator
- Size: 8.79 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vuepress Sidebar children auto-generator


[](https://github.com/omar2535/vuepress-sidebar-children-autogenerator/blob/master/LICENSE)Creates children objects so that you won't have to do it manually
## Install
via NPM
```sh
npm i @omar2535/vuepress-sidebar-children-autogenerator
```via YARN
```sh
yarn add @omar2535/vuepress-sidebar-children-autogenerator
```## Usage
```js
let childrenGenerator = require('@omar2535/vuepress-sidebar-children-autogenerator');
```then in `.vuepress/config.js`, if we had a directory structure like so:
```
.
+-- .vuepress
+-- notes
| +-- readme.md
| +-- course_notes
| +-- readme.md
| +-- PHYS100.md
| +-- random.md
```adding the following to the sidebar config like so:
```js
sidebar:
{
'/notes/': childrenGenerator('/notes/'),
}
```would result in a conversion like this when compiled:
```js
sidebar:
{
'/notes/': [
{
title: 'course_notes',
path: '/notes/course_notes/',
collapsable: true,
children: [ '/notes/course_notes/PHYS100.md' ]
},
"random.md"
],
}
```## Parameters
| Param | Required? | Default | Result |
|---|:-:|---|---|
| basePath | True | N/A | Base path of folder to generate children from |
| collapsable | false | true | Whether the children will be collapsable if any subfolders were found |
| filesToExclude | false | ["readme .md"] | Excludes file names contained in the array. Is **NOT** case sensitive, so files with the same name but difference case will be ignored |
| directoreisToExclude| false | [".vuepress", "node_modules", ".git"] | Excludes folder names contained in the array |