Webpack html-webpack-plugin load favicons in template -
i'm using webpack html-webpack-plugin
, provided template. want add list of favicons in header:
<link rel="apple-touch-icon" sizes="57x57" href="<%= htmlwebpackplugin.extrafiles.apple-touch-icon-57x57 %>"> <link rel="apple-touch-icon" sizes="60x60" href="<%= htmlwebpackplugin.extrafiles.favicons.fav60%>"> <link rel="apple-touch-icon" sizes="72x72" href="<%= htmlwebpackplugin.extrafiles.favicons.fav72%>"> <link rel="apple-touch-icon" sizes="76x76" href="favicons/apple-touch-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="favicons/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="favicons/apple-touch-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="favicons/apple-touch-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="favicons/apple-touch-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="favicons/apple-touch-icon-180x180.png"> <link rel="icon" type="image/png" href="favicons/favicon-32x32.png" sizes="32x32"> <link rel="icon" type="image/png" href="favicons/android-chrome-192x192.png" sizes="192x192"> <link rel="icon" type="image/png" href="favicons/favicon-96x96.png" sizes="96x96"> <link rel="icon" type="image/png" href="favicons/favicon-16x16.png" sizes="16x16"> <link rel="manifest" href="favicons/manifest.json"> <link rel="mask-icon" href="favicons/safari-pinned-tab.svg" color="#e53935"> <meta name="msapplication-tilecolor" content="#da532c"> <meta name="msapplication-tileimage" content="favicon/mstile-144x144.png"> <meta name="theme-color" content="#e53935">
how can include favicons in webpack build, or without html-webpack-plugin
?
i tried adding them extrafiles docs say, don't end in build folder.
note: first 3 me trying didn't work.
after numerous trials...still didn't manage make work html-webpack-plugin
, did find new library helps relating titles, descriptions, keywords,...and kind of header called react-helmet
you can find here: https://github.com/nfl/react-helmet
basically add in main component
<helmet link={[ {"rel": "apple-touch-icon", "href": require('apple-touch-icon-57x57.png'), "sizes": "57x57"} ]} />
hope helps others.
Comments
Post a Comment