Skip to content

Remove file extensions option

Latest
Compare
Choose a tag to compare
@asvae asvae released this 06 Aug 01:23
· 92 commits to master since this release

Interface change

You should pass object for your config instead of function params. This allows vue-book to add more options without breaking changes.

Here's the recommended way:

import Router from 'vue-router'
import { createRoute } from 'vue-book'

const router = new Router({
  routes: [
    createRoute({
      requireContext: require.context('./..', true, /.demo.vue$/), 
      path: '/demo',
      hideFileExtensions: true,
    }),
  ]
})

Before the change, you created the route like this:

VueBook(require.context('./../tree', true, /.vue$/), '/demo')

Deprecation is soft, so nothing will break for now. : 3.

Optional remove extension

You can remove file extensions from the list with hideFileExtensions. By default it's set to false.

createRoute({
  // ... 
  hideFileExtensions: true,
}),