Inject favicons tags into custom position using ejs template
See original GitHub issueFor example:
<head>
<!-- Seo Tags from Google, Facebook, Twitter, etc-->
<%- htmlWebpackPlugin.files.favicons.html %>
<!-- script tags from Google Analytics, etc -->
</head>
Output:
<head>
<!-- Seo Tags from Google, Facebook, Twitter, etc-->
<link rel="icon" href="...">
<meta name="..." content="...">
<!-- etc -->
<!-- script tags from Google Analytics, etc -->
</head>
</head>
Issue Analytics
- State:
- Created 4 years ago
- Comments:24 (4 by maintainers)
Top Results From Across the Web
How to set custom favicon in Express? - Stack Overflow
I already have app.use(express.static("dist")); which serves all js, img and css files referenced like /img/some_image.
Read more >HTML Favicon - W3Schools
A favicon is a small image displayed next to the page title in the browser tab. How To Add a Favicon in HTML....
Read more >How to Add Custom Dynamic Favicons in React & Next.js
Then, we want to add our Head component and favicon tags to the component tree. We can do that by creating a React...
Read more >How to add icon logo in title bar using HTML ? - GeeksforGeeks
Most of the websites adds icon or image logo in the title bar. The icon logo is also called as favicon. Adding favicons...
Read more >How to Add Image in the Title Bar - W3docs
The second way of adding favicons · The image must be square dimensioned in any image format (ico, jpg, bmp, gif, png) to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi Eddy, I managed to solve this problem!
By creating a micro plugin using hooks.
It was required to use webapp-webpack-plugin, this fork favicons-webpack-plugin with implemented support for the hook webappWebpackPluginBeforeEmit, but, unfortunately, without options
modeanddevMode.Jan, Bruno, if you are reading this, please give the opportunity to inject it into a custom template from the box or add support for hooks to FaviconsWebpackPlugin or the
devModeoption in the fork. Bad that you have to use crutches =(The crutch itself: (set below
new HtmlWebpackPlugin({ ... })and belownew WebappWebpackPlugin({ ... }))Add in your .ejs template:
Only works with webapp-webpack-plugin use
new WebappWebpackPlugin ({ otions... }).Explanations:
Why are html lincs parsed? The first reason, for greater total flexibility, is the ability to calculate the functional by adding modifications to the inserted html tags. The second reason, I tried to get link icon tags in the form of an object with parameters, from
compilation.hooks.webappWebpackPluginBeforeEmit.tap..., but there only files names and files themselves are theBufferobject, everything else: tag name, path, media data, etc. only in the form of already assembled html.This is my first experience in creating the use of webpack hooks and in general the first experience of writing a plugin for webpack, so I could not do everything absolutely right, but everything works! For example, I have a suspicion that I am transferring incorrect names to
hooks->tap, although in this case it does not affect anything.Thanks for the update 😃