Merge pull request #2755 from clarkdo/static_prefix

feature: add static.prefix
This commit is contained in:
Sébastien Chopin 2018-02-05 08:55:28 +01:00 committed by GitHub
commit 0a52cd2031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -305,7 +305,9 @@ Options.defaults = {
push: false,
shouldPush: null
},
static: {},
static: {
prefix: true
},
gzip: {
threshold: 0
},

View File

@ -249,12 +249,12 @@ module.exports = class Renderer {
}
// For serving static/ files to /
this.useMiddleware(
serveStatic(
resolve(this.options.srcDir, 'static'),
this.options.render.static
)
const staticMiddleware = serveStatic(
resolve(this.options.srcDir, 'static'),
this.options.render.static
)
staticMiddleware.prefix = this.options.render.static.prefix
this.useMiddleware(staticMiddleware)
// Serve .nuxt/dist/ files only for production
// For dev they will be served with devMiddleware