mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix(renderer): fix problem with HTMLPlugin's minify option (#3392)
This commit is contained in:
parent
7540213996
commit
1f0053c160
@ -279,6 +279,16 @@ export default class Renderer {
|
||||
this.useMiddleware(errorMiddleware.bind(this))
|
||||
}
|
||||
|
||||
renderTemplate(ssr, opts) {
|
||||
// Fix problem with HTMLPlugin's minify option (#3392)
|
||||
opts.html_attrs = opts.HTML_ATTRS
|
||||
opts.body_attrs = opts.BODY_ATTRS
|
||||
|
||||
const fn = ssr ? this.resources.ssrTemplate : this.resources.spaTemplate
|
||||
|
||||
return fn(opts)
|
||||
}
|
||||
|
||||
async renderRoute(url, context = {}) {
|
||||
/* istanbul ignore if */
|
||||
if (!this.isReady) {
|
||||
@ -320,7 +330,7 @@ export default class Renderer {
|
||||
throw err
|
||||
}
|
||||
|
||||
const html = this.resources.spaTemplate({
|
||||
const html = this.renderTemplate(false, {
|
||||
HTML_ATTRS,
|
||||
BODY_ATTRS,
|
||||
HEAD,
|
||||
@ -376,7 +386,7 @@ export default class Renderer {
|
||||
// TODO: vue-ssr need to handle https://github.com/vuejs/vue/issues/7897
|
||||
HEAD += context.renderStyles()
|
||||
|
||||
let html = this.resources.ssrTemplate({
|
||||
const html = this.renderTemplate(true, {
|
||||
HTML_ATTRS: 'data-n-head-ssr ' + m.htmlAttrs.text(),
|
||||
BODY_ATTRS: m.bodyAttrs.text(),
|
||||
HEAD,
|
||||
|
Loading…
Reference in New Issue
Block a user