auto-generate-vitepress-config
v0.1.9
Published
automatically generate your vitepress config
Downloads
3
Readme
auto-generate-vitepress-config
What is it ?
Usually, if we want to add an article on vitepress, we have to go through the following two steps:
- write a new post
- add relative config in .vitepress/config.js
One post is ok. However, if we write a lot of articles at once,do we need to add configuration information one by one?
That's too terrible.
auto-generate-vitepress-config can help you automaticlly generate right configuration.
All you need to do is write posts.
How to use ?
npm i auto-generate-vitepress-config
- add
{ autoGenerateConfig } = require('auto-generate-vitepress-config');
in .vitepress/config.js - delete the content of original config sidebar
- Pass the config object into the function
Vitepress Directory Structure
- Blog
| - docs
| | - .vitepress
| | - handbook // root path of articles
| - - - | - react
| - - - | - vue
| - node_modules
// basic exmaple only one sidebar
const { autoGenerateConfig }= require('auto-generate-vitepress-config');
// The outermost directory where the article is stored
const ROOTFOLDERPATH = 'handbook';
const config = {
title: "Vitepress",
description: "Write My Mind",
base: "/Blog",
themeConfig: {
sidebar: []
}
}
module.exports = autoGenerateConfig(config, ROOTFOLDERPATH);
// multi sidebar
const { autoGenerateConfigMulti }= require('auto-generate-vitepress-config');
const config = {
title: "Vitepress",
description: "Write My Mind",
base: "/Blog",
themeConfig: {
nav: []
sidebar: {}
}
}
module.exports = autoGenerateConfigMulti(config);
Note
Currently, this is a simple version, which only meet basic demand.After that, I will constantly improve its functionality and release it as an npm package。
If it is helpful to you, please help me star.
More abilities is coming...