https://github.com/falinor/vue-markdown-routing
Generate Vue Router routes automatically using a markdown arborescence.
https://github.com/falinor/vue-markdown-routing
Last synced: 2 months ago
JSON representation
Generate Vue Router routes automatically using a markdown arborescence.
- Host: GitHub
- URL: https://github.com/falinor/vue-markdown-routing
- Owner: Falinor
- License: mit
- Created: 2020-04-28T08:26:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-01T22:37:40.000Z (almost 6 years ago)
- Last Synced: 2025-02-06T20:07:16.108Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 936 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vue-markdown-routing
Generate Vue Router routing automatically.
## Installation
```bash
$ npm install -D vue-markdown-routing
```
## Requirements
- webpack >= v4.0.0
## Usage
To use this, you import `vue-markdown-routing` and pass it into Vue Router constructor options.
```js
// Import generated routes
import routes from 'vue-md-auto-routing'
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
export default new Router({
// Pass the generated routes into the routes option
routes
})
```
You also need to add a webpack plugin vue-auto-routing provides. The plugin options are the same as [vue-route-generator options](https://github.com/ktsn/vue-route-generator#references)
```js
// webpack.config.js
const path = require('path')
const VueAutoRoutingPlugin = require('vue-auto-routing/lib/webpack-plugin')
module.exports = {
// ... other options ...
plugins: [
new VueAutoRoutingPlugin({
// Directories to load markdown assets from
folders: [
path.resolve(__dirname, 'src', 'assets', 'guides'),
path.resolve(__dirname, 'src', 'assets', 'articles')
],
// A string that will be added to importing component path (defaults to @/assets/).
importPrefix: '@/assets/'
})
]
}
```
## Related Projects
* [vue-md-route-generator](https://github.com/Falinor/vue-md-route-generator): Low-level utility generating routes based on a markdown arborescence.
## License
MIT
## Thanks
Thanks to [ktsn](https://github.com/ktsn) for the initial code!