3.1.0 • Published 4 years ago

@omar2535/vuepress-sidebar-children-autogenerator v3.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Sidebar children autogenerator for vuepress

https://www.npmjs.com/package/@omar2535/vuepress-sidebar-children-autogenerator https://www.npmjs.com/package/@omar2535/vuepress-sidebar-children-autogenerator GitHub license

Creates children objects so that you won't have to do it manually

Install

via NPM

npm i @omar2535/vuepress-sidebar-children-autogenerator

via YARN

yarn add @omar2535/vuepress-sidebar-children-autogenerator

Usage

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:

sidebar: 
{
  '/notes/': childrenGenerator('/notes/'),
}

would result in a conversion like this when compiled:

sidebar: 
{
  '/notes/': [
    {
      title: 'course_notes',
      path: '/notes/course_notes/',
      collapsable: true,
      children: [ '/notes/course_notes/PHYS100.md' ]
    },
    "random.md"
  ],
}

Parameters

ParamRequired?DefaultResult
basePathTrueN/ABase path of folder to generate children from
collapsablefalsetrueWhether the children will be collapsable if any subfolders were found
filesToExcludefalse"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
directoreisToExcludefalse".vuepress", "node_modules", ".git"Excludes folder names contained in the array
3.1.0

4 years ago

3.0.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago