Skip to content

Commit ecaa835

Browse files
author
Pooya Parsa
committedNov 16, 2017
fix(manifest): run only on build
1 parent b0af84e commit ecaa835

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

Diff for: ‎packages/manifest/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
const hash = require('hash-sum')
2+
const debug = require('debug')('nuxt:pwa:manifest')
23

34
const fixUrl = url => url.replace(/\/\//g, '/').replace(':/', '://')
45
const isUrl = url => url.indexOf('http') === 0 || url.indexOf('//') === 0
56
const find = (arr, key, val) => arr.find(obj => val ? obj[key] === val : obj[key])
67

78
module.exports = function nuxtManifest (options) {
9+
this.nuxt.plugin('build', builder => {
10+
debug('Adding manifest')
11+
addManifest.call(this, options)
12+
})
13+
}
14+
15+
function addManifest (options) {
816
// routerBase and publicPath
917
const routerBase = this.options.router.base
1018
let publicPath = fixUrl(`${routerBase}/${this.options.build.publicPath}`)

0 commit comments

Comments
 (0)
Please sign in to comment.