-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Writing Your Own Templates section does not work #1826
Comments
I've managed to partially solve the issue by removing from my
But the Also, another issue, is that, if I remove the rule for |
I just faced this same issue. Looking at the link below, it says "However this also means that in the following example webpack will use the html loader for your template. This will cause html minification and it will also disable the ejs/lodash fallback loader." So I would assume that the ejs/lodash loader is required to set the templateParameters? Which explains why disabling the html-loader is working in your case. To bundle the favicon, you can use the favicon option in html-webpack-plugin? https://github.com/jantimon/html-webpack-plugin/blob/main/docs/template-option.md Edit: There seems to be a way to run both html-loader and ejs loader if needed: https://stackoverflow.com/questions/56726509/webpack-chaining-loaders/61795641#61795641 |
Current behaviour 💣
I am trying to use the
templateParameters
to pass some variables into my template and it does not work.I have followed the examples shown:
Expected behaviour ☀️
I would like my
<%= title %>
to be replaced with the actual value of mytemplateParameters.title
value, i.e. value located insidelocales/de-DE.json
orlocales/en-GB.json
.I've also tried to modify the
<%= title %>
to<%= htmlWebpackPlugin.options.templateParameters.title %>
.Reproduction Example 👾
I have created a small repository to reproduce this issue here: https://github.com/einazare/html-webpack-plugin-18n-generator
You will need to:
npm install
npm run build
dist/index.html
<%= title %>
was not replaced bySome title written in English (Great Britain)
Environment 🖥
All the versions from my
package.json
file here:Also, the output of the above commands here:
Thank you 🙏
The text was updated successfully, but these errors were encountered: