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, push: false,
shouldPush: null shouldPush: null
}, },
static: {}, static: {
prefix: true
},
gzip: { gzip: {
threshold: 0 threshold: 0
}, },

View File

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