Skip to content

Commit

Permalink
fix(manifest): run only on build
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Nov 16, 2017
1 parent b0af84e commit ecaa835
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/manifest/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
const hash = require('hash-sum')
const debug = require('debug')('nuxt:pwa:manifest')

const fixUrl = url => url.replace(/\/\//g, '/').replace(':/', '://')
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) {
this.nuxt.plugin('build', builder => {
debug('Adding manifest')
addManifest.call(this, options)
})
}

function addManifest (options) {
// routerBase and publicPath
const routerBase = this.options.router.base
let publicPath = fixUrl(`${routerBase}/${this.options.build.publicPath}`)
Expand Down

0 comments on commit ecaa835

Please sign in to comment.