# vue-auto-routing

> Generate Vue Router routing automatically

Latest version **1.0.1** (published 2021-01-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-auto-routing
pnpm add vue-auto-routing
yarn add vue-auto-routing
bun add vue-auto-routing
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-01-06 |
| First published | 2018-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 250 |
| Author | katashin |
| Maintainers | ktsn |
| Keywords | Vue, Vue Router, routing, auto generate, generator, webpack, plugin |

## Links

- npm: https://www.npmjs.com/package/vue-auto-routing
- Repository: https://github.com/ktsn/vue-auto-routing
- Issues: https://github.com/ktsn/vue-auto-routing/issues
- npm.io page: https://npm.io/package/vue-auto-routing

## Dependencies (1)

- [vue-route-generator](https://npm.io/package/vue-route-generator.md) ^1.0.0

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-01-06
- 0.6.0 — 2021-01-06
- 0.5.0 — 2020-05-19
- 0.4.1 — 2020-01-11
- 0.4.0 — 2019-08-15
- 0.3.0 — 2018-09-26
- 0.2.0 — 2018-07-28
- 0.1.2 — 2018-07-14
- 0.1.1 — 2018-07-14
- 0.1.0 — 2018-07-14

## README

# vue-auto-routing

Generate Vue Router routing automatically.

You may want to use [vue-cli-plugin-auto-routing](https://github.com/ktsn/vue-cli-plugin-auto-routing) which includes all useful features on routing.

## Installation

```bash
$ npm install -D vue-auto-routing
```

## Requirements

- webpack >= v4.0.0

## Usage

vue-auto-routing resolves Vue Router routing automatically by using [vue-route-generator](https://github.com/ktsn/vue-route-generator). The routes are generated with the same rules with [Nuxt routing](https://nuxtjs.org/guide/routing).

To use this, you import `vue-auto-routing` and pass it into Vue Router constructor options.

```js
// Import generated routes
import routes from 'vue-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 VueAutoRoutingPlugin = require('vue-auto-routing/lib/webpack-plugin')

module.exports = {
  // ... other options ...

  plugins: [
    new VueAutoRoutingPlugin({
      // Path to the directory that contains your page components.
      pages: 'src/pages',

      // A string that will be added to importing component path (default @/pages/).
      importPrefix: '@/pages/'
    })
  ]
}
```

## Related Projects

* [vue-cli-plugin-auto-routing](https://github.com/ktsn/vue-cli-plugin-auto-routing): Vue CLI plugin including auto pages and layouts resolution.
* [vue-router-layout](https://github.com/ktsn/vue-router-layout): Lightweight layout resolver for Vue Router.
* [vue-route-generator](https://github.com/ktsn/vue-route-generator): Low-level utility generating routing which vue-auto-routing using under the hood.

## License

MIT

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