# vue-router-loader-yaml

> load vue-router config via yaml file

Latest version **0.0.6** (published 2017-06-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install vue-router-loader-yaml
pnpm add vue-router-loader-yaml
yarn add vue-router-loader-yaml
bun add vue-router-loader-yaml
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2017-06-05 |
| First published | 2017-04-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | foolishchow |
| Maintainers | foolishchow |
| Keywords | vue-router, yaml, config, webpack, loader |

## Links

- npm: https://www.npmjs.com/package/vue-router-loader-yaml
- Repository: https://github.com/foolishchow/vue-router-loader-yaml
- Homepage: https://github.com/foolishchow/vue-router-loader-yaml#readme
- Issues: https://github.com/foolishchow/vue-router-loader-yaml/issues
- npm.io page: https://npm.io/package/vue-router-loader-yaml

## Dependencies (1)

- [js-yaml](https://npm.io/package/js-yaml.md) ^3.5.2

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 0.0.6 (latest) — 2017-06-05
- 0.0.5 — 2017-06-04
- 0.0.4 — 2017-05-23
- 0.0.3 — 2017-05-23
- 0.0.2 — 2017-04-20
- 0.0.1 — 2017-04-14

## README

# vue-router-loader-yaml
load vue-router config via yaml
> `0.0.3` meta can config in yaml 


> useage   
```shell
 npm install vue-router-loader-yaml --save-dev
```
in your webpack.config.js
```js
rules: [
    {
        test: /router\.yaml$/,
        loader: 'babel-loader!vue-router-loader-yaml'
    },
    // ...
],
//...

```

> common useage   

 your yaml file:
```yaml
index:
    path: /
    component: ./platform/system/index/index.vue
    meta:
        nav: none
```
output:   

```js
import index from './platform/system/index/index.vue';

export default [
{
    path: '/',
    component: index.
    meta:{nav:'none'}
}];

```

> lazyload    
```yaml
userList:
    path: /users
    component: ./platform/system/users/user.vue
    lazy:  system
```
output:   

```js
const userList = r=>require.ensure([],()=>r(require('./platform/system/users/user.vue')),'system');

export default [
{
    path: '/users',
    component: userList
}];

```

> Nested router   

```yaml
index:
    path: /
    component: ./platform/system/index/index.vue
    children:
        userList:
            path: /users
            component: ./platform/system/users/index.vue
            lazy:  system
        testList:
            path: /test
            component: ./platform/system/test/index.vue
            lazy:  system
```
output:   

```js
const userList = r=>require.ensure([],()=>r(require('./platform/system/users/index.vue')),'system');
const testList = r=>require.ensure([],()=>r(require('./platform/system/test/index.vue')),'system');
import index from './platform/system/index/index.vue';

export default [
{
    path: '/',
    component: index,
    children:[
{
    path: '/users',
    component: userList
},
{
    path: '/test',
    component: testList
}]}];

```

> lazyload extends and overwrited      
```yaml
index:
    path: /
    component: ./platform/system/index/index.vue
    lazy: base
    children:
        users:
            path: /users
            component: ./platform/system/users/index.vue
            lazy:  False
        testList:
            path: /test
            component: ./platform/system/test/index.vue
            lazy:  system
        mainList:
            path: /main
            component: ./platform/system/main/index.vue
````
- outout:
```js
import users from './platform/system/users/index.vue';
const testList = r=>require.ensure([],()=>r(require('./platform/system/test/index.vue')),'system');
const mainList = r=>require.ensure([],()=>r(require('./platform/system/main/index.vue')),'base');
const index = r=>require.ensure([],()=>r(require('./platform/system/index/index.vue')),'base');

export default [
{
    path: '/',
    component: index,
    children:[
{
    path: '/users',
    component: users
},
{
    path: '/test',
    component: testList
},
{
    path: '/main',
    component: mainList
}]}];
```

---
_Source: https://npm.io/package/vue-router-loader-yaml · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
