Skip to content
This repository has been archived by the owner on Feb 27, 2021. It is now read-only.
/ collect-fs-routes Public archive

Get vue-router routes config from file system.

License

Notifications You must be signed in to change notification settings

ream/collect-fs-routes

Repository files navigation

collect-fs-routes

NPM version NPM downloads CircleCI

This is used by Ream and similar Vue SSR / static site generator.

Install

yarn add @ream/collect-fs-routes

Usage

const { collectRoutes } = require('@ream/collect-fs-routes')

const routes = collectRoutes(options)
const routesString = renderRoutes(routes)

API

collectRoutes([options])

options.pagesDir

  • Type: string
  • Default: 'pages'

The directory to page components.

options.componentPrefix

  • Type: string
  • Default: ''

The path prefix for component property in vue-router route records.

options.basePath

  • Type: string
  • Default: '/'

The base path for path property in vue-roouter route records.

options.match

  • Type: RegExp
  • Default: /\.(vue|js)$/

The regular expression that is used to match page components.

options.statCache

  • Type: Object
  • Default: undefined

Cache of fs.stat results.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

collect-fs-routes © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).

github.com/EGOIST · GitHub @EGOIST · Twitter @_egoistlily

About

Get vue-router routes config from file system.

Resources

License

Stars

Watchers

Forks

Packages

No packages published