Skip to content

Commit

Permalink
feat(icon): register favicon.ico when available (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogobbosouza authored Mar 12, 2020
1 parent a34423a commit 7a48d2a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/meta/module.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { join } = require('path')
const { existsSync } = require('fs')
const { find, isUrl } = require('../utils')

module.exports = function nuxtMeta (pwa) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7a48d2a

Please sign in to comment.