Vue.js PWA Manifest Icons and Favicon

Dec 9, 2019

Default

By default, the following is generated.

manifest.json

{   "name":"journey-static",   "short_name":"journey-static",   "theme_color":"#4DBA87",   "icons":[      {         "src":"./img/icons/android-chrome-192x192.png",         "sizes":"192x192",         "type":"image/png"      },      {         "src":"./img/icons/android-chrome-512x512.png",         "sizes":"512x512",         "type":"image/png"      }   ],   "start_url":".",   "display":"standalone",   "background_color":"#000000"}

public/img

favicon.ico
icons/android-chrome-192x192.png
icons/android-chrome-512x512.png
icons/apple-touch-icon-120x120.png
icons/apple-touch-icon-152x152.png
icons/apple-touch-icon-180x180.png
icons/apple-touch-icon-60x60.png
icons/apple-touch-icon-76x76.png
icons/apple-touch-icon.png
icons/favicon-16x16.png
icons/favicon-32x32.png
icons/msapplication-icon-144x144.png
icons/mstile-150x150.png
icons/safari-pinned-tab.svg

index.html

<!DOCTYPE html><html lang="en">    <head>        ...        <!--[if IE]><link rel="icon" href="/favicon.ico"><![endif]-->        <link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png">        <link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png">        <meta name="theme-color" content="#4DBA87">        <meta name="apple-mobile-web-app-capable" content="no">        <meta name="apple-mobile-web-app-status-bar-style" content="default">        <meta name="apple-mobile-web-app-title" content="journey-static">        <link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png">        <link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87">        <meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png">        <meta name="msapplication-TileColor" content="#000000">    </head>...</html>

Generate/Change Icons

I believe neither Vue.js nor @vue/cli-plugin-pwa provide any toolings to generate the necessary icons.

Use https://realfavicongenerator.net/

  • At Favicon for iOS - Web Clip, check Add a solid, plain background to fill the transparent regions. Switch to Assets tab, check Create all icons for iOS 7 and later and Create all icons for iOS 6 and prior.

Click Generate your Favicons and HTML code

The following files are generated.

android-chrome-192x192.png
android-chrome-512x512.png
apple-touch-icon-114x114.png
apple-touch-icon-120x120.png
apple-touch-icon-144x144.png
apple-touch-icon-152x152.png
apple-touch-icon-180x180.png
apple-touch-icon-57x57.png
apple-touch-icon-60x60.png
apple-touch-icon-72x72.png
apple-touch-icon-76x76.png
apple-touch-icon.png
apple-touch-icon-precomposed.png
favicon-16x16.png
favicon-32x32.png
favicon.ico
mstile-150x150.png
safari-pinned-tab.svg

Copy the files to public/img/icons.

Copy favicon.ico to public.

Edit PWA Configurations

Edit vue.config.js

module.exports = {  // ...other vue-cli plugin options...  pwa: {    themeColor: '#17a2b8',    msTileColor: '#000000',    iconPaths: {      msTileImage: 'img/icons/mstile-150x150.png'    }  }}

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.