fix: serialize config head fn shorthand correctly (#4283)

[skip ci]
This commit is contained in:
Alexander Lichter 2018-11-07 22:33:09 +00:00 committed by Pooya Parsa
parent 1abbeb0e10
commit b3eb4278a5
2 changed files with 6 additions and 4 deletions

View File

@ -18,7 +18,7 @@ const layouts = { <%= Object.keys(layouts).map(key => `"_${key}": _${hash(key)}`
export default { export default {
<%= isTest ? '/* eslint-disable quotes, semi, indent, comma-spacing, key-spacing, object-curly-spacing, object-property-newline, arrow-parens */' : '' %> <%= isTest ? '/* eslint-disable quotes, semi, indent, comma-spacing, key-spacing, object-curly-spacing, object-property-newline, arrow-parens */' : '' %>
head: <%= serialize(head).replace(/:\w+\(/gm, ':function(') %>, head: <%= serialize(head).replace(/:\w+\(/gm, ':function(').replace('head(', 'function(') %>,
<%= isTest ? '/* eslint-enable quotes, semi, indent, comma-spacing, key-spacing, object-curly-spacing, object-property-newline, arrow-parens */' : '' %> <%= isTest ? '/* eslint-enable quotes, semi, indent, comma-spacing, key-spacing, object-curly-spacing, object-property-newline, arrow-parens */' : '' %>
render(h, props) { render(h, props) {
<% if (loading) { %>const loadingEl = h('nuxt-loading', { ref: 'loading' })<% } %> <% if (loading) { %>const loadingEl = h('nuxt-loading', { ref: 'loading' })<% } %>

View File

@ -36,10 +36,12 @@ export default {
interval: 200, interval: 200,
subFolders: true subFolders: true
}, },
head: { head() {
return {
titleTemplate: (titleChunk) => { titleTemplate: (titleChunk) => {
return titleChunk ? `${titleChunk} - Nuxt.js` : 'Nuxt.js' return titleChunk ? `${titleChunk} - Nuxt.js` : 'Nuxt.js'
} }
}
}, },
modulesDir: path.join(__dirname, '..', '..', '..', 'node_modules'), modulesDir: path.join(__dirname, '..', '..', '..', 'node_modules'),
hooks: { hooks: {