I have a small application written in Webpack using HTML Webpack Plugin: https://github.com/einazare/html-webpack-plugin-18n-generator
And I am trying to use templateParameters to pass some variables to my HTML template, and it won't work. I do not know if this is a bug from the plugin, or I am doing something wrong.
I have followed the examples shown:
- Here: https://github.com/jantimon/html-webpack-plugin#writing-your-own-templates
- And here: https://github.com/jantimon/html-webpack-plugin/tree/main/examples/template-parameters
I would like my <%= title %> to be replaced with the actual value of my templateParameters.title value, i.e. value located inside locales/de-DE.json or locales/en-GB.json.
I've also tried to modify the <%= title %> to <%= htmlWebpackPlugin.options.templateParameters.title %>.
If you want, you can clone the repository and then:
- Install the dependencies with
npm install - Build the application with
npm run build - Open
dist/index.htmlin an editor - You will see
<%= title %>was not replaced bySome title written in English (Great Britain)