@vapster/nuxt-router-module

Nuxt.js module to use custom router instead of pages/ directory.

Usage no npm install needed!

<script type="module">
  import vapsterNuxtRouterModule from 'https://cdn.skypack.dev/@vapster/nuxt-router-module';
</script>

README

Nuxt Router Module

Nuxt module to use router.js instead of pages/ directory.

Setup

  1. Install @vapster/nuxt-router-module dependency with yarn or npm
  2. Add @vapster/nuxt-router-module to modules section of nuxt.config.js:
{
  modules: [
    // without options
    '@vapster/nuxt-router-module',
    
    // with options
    [
      '@vapster/nuxt-router-module',
      {
        path: 'router',
        filename: 'index.js',
        templateName: 'router.js',
      },
    ],
  ]
}
  1. If you are using SPA mode, add an index / route to generate section of nuxt.config.js:
{
  generate: {
    routes: [
      '/'
    ]
  }
}

License

MIT License

Copyright (c) 2018 Vova Revenko vova@revenko.org