How to change favicon on Vuejs CLI ?
<link rel="shortcut icon" type="image/png" href="/src/assets/img/logo.png"/>
Vue CLI (3.0.5
) generates projects with the <root>/public
directory containing the favicon.ico
and index.html
(which references the favicon.ico
).
It seems you have your icon in <root>/src/assets
. I recommend moving it to <root>/public
, replacing favicon.ico
with jinane-logo-JC.png
, and updating index.html
accordingly:
<!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> --> <!-- REPLACE THIS -->
<link rel="icon" href="<%= BASE_URL %>jinane-logo-JC.png">
(function() {
var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = 'http://www.stackoverflow.com/favicon.ico';
document.getElementsByTagName('head')[0].appendChild(link);
})();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With