Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pwa): Check for null or undefined in iconPaths #5087

Merged
merged 1 commit into from Mar 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 31 additions & 17 deletions packages/@vue/cli-plugin-pwa/lib/HtmlPwaPlugin.js
Expand Up @@ -81,22 +81,26 @@ module.exports = class HtmlPwaPlugin {

const assetsVersionStr = assetsVersion ? `?v=${assetsVersion}` : ''

data.head.push(
// Favicons
makeTag('link', {
// Favicons
if (iconPaths.favicon32 != null) {
data.head.push(makeTag('link', {
rel: 'icon',
type: 'image/png',
sizes: '32x32',
href: getTagHref(publicPath, iconPaths.favicon32, assetsVersionStr)
}),
makeTag('link', {
}))
}
if (iconPaths.favicon16 != null) {
data.head.push(makeTag('link', {
rel: 'icon',
type: 'image/png',
sizes: '16x16',
href: getTagHref(publicPath, iconPaths.favicon16, assetsVersionStr)
}),
}))
}

// Add to home screen for Android and modern mobile browsers
// Add to home screen for Android and modern mobile browsers
data.head.push(
makeTag('link', manifestCrossorigin
? {
rel: 'manifest',
Expand All @@ -111,9 +115,11 @@ module.exports = class HtmlPwaPlugin {
makeTag('meta', {
name: 'theme-color',
content: themeColor
}),
})
)

// Add to home screen for Safari on iOS
// Add to home screen for Safari on iOS
data.head.push(
makeTag('meta', {
name: 'apple-mobile-web-app-capable',
content: appleMobileWebAppCapable
Expand All @@ -125,22 +131,30 @@ module.exports = class HtmlPwaPlugin {
makeTag('meta', {
name: 'apple-mobile-web-app-title',
content: name
}),
makeTag('link', {
})
)
if (iconPaths.appleTouchIcon != null) {
data.head.push(makeTag('link', {
rel: 'apple-touch-icon',
href: getTagHref(publicPath, iconPaths.appleTouchIcon, assetsVersionStr)
}),
makeTag('link', {
}))
}
if (iconPaths.maskIcon != null) {
data.head.push(makeTag('link', {
rel: 'mask-icon',
href: getTagHref(publicPath, iconPaths.maskIcon, assetsVersionStr),
color: themeColor
}),
}))
}

// Add to home screen for Windows
makeTag('meta', {
// Add to home screen for Windows
if (iconPaths.msTileImage != null) {
data.head.push(makeTag('meta', {
name: 'msapplication-TileImage',
content: getTagHref(publicPath, iconPaths.msTileImage, assetsVersionStr)
}),
}))
}
data.head.push(
makeTag('meta', {
name: 'msapplication-TileColor',
content: msTileColor
Expand Down