From 7a48d2a60b1f2ccaa1287789adb846806afd5224 Mon Sep 17 00:00:00 2001 From: Ricardo Gobbo de Souza Date: Thu, 12 Mar 2020 08:20:42 -0300 Subject: [PATCH] feat(icon): register `favicon.ico` when available (#258) --- lib/meta/module.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/meta/module.js b/lib/meta/module.js index c4fd3b08..ea26b2c3 100755 --- a/lib/meta/module.js +++ b/lib/meta/module.js @@ -1,3 +1,5 @@ +const { join } = require('path') +const { existsSync } = require('fs') const { find, isUrl } = require('../utils') module.exports = function nuxtMeta (pwa) { @@ -96,6 +98,13 @@ function generateMeta (pwa) { } } + const favicon = join(this.options.srcDir, this.options.dir.static, 'favicon.ico') + if (options.favicon && !find(this.options.head.link, 'rel', 'shortcut icon') && existsSync(favicon)) { + console.warn('You are using a low quality icon, use icon png. See https://pwa.nuxtjs.org/modules/icon.html') + + this.options.head.link.push({ rel: 'shortcut icon', href: 'favicon.ico' }) + } + // Title if (options.name && !this.options.head.title && typeof this.options.head.titleTemplate !== 'function') { this.options.head.title = options.name