Skip to content

Commit 3f82947

Browse files
authored
feat: support SVG favicon (#6198)
1 parent 3608b04 commit 3f82947

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

packages/@vue/cli-plugin-pwa/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ file, or the `"vue"` field in `package.json`.
9696

9797
```js
9898
{
99+
faviconSVG: 'img/icons/favicon.svg',
99100
favicon32: 'img/icons/favicon-32x32.png',
100101
favicon16: 'img/icons/favicon-16x16.png',
101102
appleTouchIcon: 'img/icons/apple-touch-icon-152x152.png',

packages/@vue/cli-plugin-pwa/lib/HtmlPwaPlugin.js

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const defaultManifest = {
4545
}
4646

4747
const defaultIconPaths = {
48+
faviconSVG: 'img/icons/favicon.svg',
4849
favicon32: 'img/icons/favicon-32x32.png',
4950
favicon16: 'img/icons/favicon-16x16.png',
5051
appleTouchIcon: 'img/icons/apple-touch-icon-152x152.png',
@@ -84,6 +85,13 @@ module.exports = class HtmlPwaPlugin {
8485
const assetsVersionStr = assetsVersion ? `?v=${assetsVersion}` : ''
8586

8687
// Favicons
88+
if (iconPaths.faviconSVG != null) {
89+
data.headTags.push(makeTag('link', {
90+
rel: 'icon',
91+
type: 'image/svg+xml',
92+
href: getTagHref(publicPath, iconPaths.faviconSVG, assetsVersionStr)
93+
}))
94+
}
8795
if (iconPaths.favicon32 != null) {
8896
data.headTags.push(makeTag('link', {
8997
rel: 'icon',

0 commit comments

Comments
 (0)