Skip to content

Commit 7a48d2a

Browse files
feat(icon): register favicon.ico when available (#258)
1 parent a34423a commit 7a48d2a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/meta/module.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const { join } = require('path')
2+
const { existsSync } = require('fs')
13
const { find, isUrl } = require('../utils')
24

35
module.exports = function nuxtMeta (pwa) {
@@ -96,6 +98,13 @@ function generateMeta (pwa) {
9698
}
9799
}
98100

101+
const favicon = join(this.options.srcDir, this.options.dir.static, 'favicon.ico')
102+
if (options.favicon && !find(this.options.head.link, 'rel', 'shortcut icon') && existsSync(favicon)) {
103+
console.warn('You are using a low quality icon, use icon png. See https://pwa.nuxtjs.org/modules/icon.html')
104+
105+
this.options.head.link.push({ rel: 'shortcut icon', href: 'favicon.ico' })
106+
}
107+
99108
// Title
100109
if (options.name && !this.options.head.title && typeof this.options.head.titleTemplate !== 'function') {
101110
this.options.head.title = options.name

0 commit comments

Comments
 (0)