From 1051b733f9234905d34ba21a460bd8a0b1688528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 18 Jan 2017 17:25:38 +0100 Subject: [PATCH] Add extendRoutes option --- lib/build/index.js | 4 ++++ lib/nuxt.js | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/build/index.js b/lib/build/index.js index 496889b0ea..d689b89f26 100644 --- a/lib/build/index.js +++ b/lib/build/index.js @@ -184,6 +184,10 @@ function * generateRoutesAndFiles () { } // Format routes for the lib/app/router.js template templateVars.router.routes = createRoutes(files, this.srcDir) + if (typeof this.options.router.extendRoutes === 'function') { + // let the user extend the routes + this.options.router.extendRoutes(templateVars.router.routes) + } if (layoutsFiles.includes('layouts/error.vue')) { templateVars.components.ErrorPage = r(this.srcDir, 'layouts/error.vue') } diff --git a/lib/nuxt.js b/lib/nuxt.js index cf41349222..37418c88fb 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -19,10 +19,6 @@ class Nuxt { constructor (options = {}) { var defaults = { - // special options - _renderer: true, - _build: true, - // general options dev: true, env: {}, head: {}, @@ -41,7 +37,8 @@ class Nuxt { }, router: { base: '/', - linkActiveClass: 'nuxt-link-active' + linkActiveClass: 'nuxt-link-active', + extendRoutes: null }, build: {} }