Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wangtianyu456/vuepress-generateSidebar
vuepress 自动根据pages目录生成sidebar
https://github.com/wangtianyu456/vuepress-generateSidebar
Last synced: 14 days ago
JSON representation
vuepress 自动根据pages目录生成sidebar
- Host: GitHub
- URL: https://github.com/wangtianyu456/vuepress-generateSidebar
- Owner: wangtianyu456
- License: mit
- Created: 2020-04-12T08:52:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T12:19:01.000Z (over 2 years ago)
- Last Synced: 2024-09-13T17:13:41.928Z (2 months ago)
- Language: JavaScript
- Size: 300 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vuepress-generateSidebar
vuepress 自动根据 pages 目录生成 sidebar
```bash
yarn add vuepress-generatesidebar -D
```确保你的页面在 pages 目录下
```javascript
const generateSidebarConfig = require('vuepress-generatesidebar')/**
* generateSidebarConfig 接受三个参数
* @param pagesDirPath 指的是pages目录的路径
* @param exclude 指的是你要排除在外的目录名单
* @param options 指的是你对sidebar中的其他额外配置
*/const pagesDirPath = path.join(__dirname, '../pages')
const exclude = ['.DS_Store', 'assets']
const options = {
collapsable: false,
}
const sidebarConfig = generateSidebarConfig(pagesDirPath, exclude)module.exports = {
title: 'your-website',
description: 'website',
base: '/',
markdown: {
lineNumbers: true,
},
themeConfig: {
// ...
},
// ...
sidebar: sidebrConfig,
}
```