Skip to content

Commit

Permalink
fix: workaround to fill meta with SPA and nuxt start
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Nov 17, 2017
1 parent 36736bd commit a0fb908
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/icon/index.js
Expand Up @@ -7,11 +7,15 @@ const fixUrl = url => url.replace(/\/\//g, '/').replace(':/', '://')
const isUrl = url => url.indexOf('http') === 0 || url.indexOf('//') === 0

module.exports = function nuxtIcon (options) {
const hook = builder => {
const hook = () => {
debug('Adding icons')
return generateIcons.call(this, options)
}

if (this.options.mode === 'spa') {
return hook()
}

this.nuxt.hook ? this.nuxt.hook('build:before', hook) : this.nuxt.plugin('build', hook)
}

Expand Down
6 changes: 5 additions & 1 deletion packages/manifest/index.js
Expand Up @@ -6,11 +6,15 @@ const isUrl = url => url.indexOf('http') === 0 || url.indexOf('//') === 0
const find = (arr, key, val) => arr.find(obj => val ? obj[key] === val : obj[key])

module.exports = function nuxtManifest (options) {
const hook = builder => {
const hook = () => {
debug('Adding manifest')
addManifest.call(this, options)
}

if (this.options.mode === 'spa') {
return hook()
}

this.nuxt.hook ? this.nuxt.hook('build:before', hook) : this.nuxt.plugin('build', hook)
}

Expand Down
6 changes: 5 additions & 1 deletion packages/meta/index.js
Expand Up @@ -3,11 +3,15 @@ const debug = require('debug')('nuxt:pwa')
const find = (arr, key, val) => arr.find(obj => val ? obj[key] === val : obj[key])

module.exports = function nuxtMeta (_options) {
const hook = builder => {
const hook = () => {
debug('Adding meta')
generateMeta.call(this, _options)
}

if (this.options.mode === 'spa') {
return hook()
}

this.nuxt.hook ? this.nuxt.hook('build:before', hook) : this.nuxt.plugin('build', hook)
}

Expand Down

0 comments on commit a0fb908

Please sign in to comment.