diff --git a/packages/icon/index.js b/packages/icon/index.js index 5f6f29d5..49258bfa 100755 --- a/packages/icon/index.js +++ b/packages/icon/index.js @@ -1,11 +1,19 @@ const fs = require('fs-extra') const path = require('path') const Jimp = require('jimp') +const debug = require('debug')('nuxt:pwa:icon') const fixUrl = url => url.replace(/\/\//g, '/').replace(':/', '://') const isUrl = url => url.indexOf('http') === 0 || url.indexOf('//') === 0 module.exports = function nuxtIcon (options) { + this.nuxt.plugin('build', builder => { + debug('Generating icons') + generateIcons.call(this, options) + }) +} + +function generateIcons (options) { const iconSrc = options.iconSrc || path.resolve(this.options.srcDir, 'static', 'icon.png') const sizes = options.sizes || [64, 120, 144, 152, 192, 384, 512] @@ -22,7 +30,7 @@ module.exports = function nuxtIcon (options) { // Ensure icon file exists if (!fs.existsSync(iconSrc)) { /* eslint-disable no-console */ - console.warn('[@nuxtjs/icon]', path.relative(this.options.srcDir, iconSrc), 'not found! Please create one or disable icon module.') + debug(path.relative(this.options.srcDir, iconSrc), 'not found! Please create one or disable icon module.') return }