add render.resourceHints option

#899
This commit is contained in:
Pooya Parsa 2017-06-20 17:18:25 +04:30
parent 5ad640b294
commit 0f85308191
2 changed files with 9 additions and 2 deletions

View File

@ -131,6 +131,7 @@ const defaultOptions = {
}, },
render: { render: {
ssr: {}, ssr: {},
resourceHints: true,
http2: { http2: {
push: false push: false
}, },

View File

@ -328,8 +328,14 @@ export default class Renderer extends Tapable {
if (this.options._routerBaseSpecified) { if (this.options._routerBaseSpecified) {
HEAD += `<base href="${this.options.router.base}">` HEAD += `<base href="${this.options.router.base}">`
} }
const resourceHints = context.renderResourceHints()
HEAD += resourceHints + context.renderStyles() let resourceHints = ''
if (this.options.render.resourceHints) {
resourceHints = context.renderResourceHints()
HEAD += resourceHints
}
HEAD += context.renderStyles()
APP += `<script type="text/javascript">window.__NUXT__=${serialize(context.nuxt, { isJSON: true })}</script>` APP += `<script type="text/javascript">window.__NUXT__=${serialize(context.nuxt, { isJSON: true })}</script>`
APP += context.renderScripts() APP += context.renderScripts()