HTML Webpack Plugin v5 - templateParameters

118 Views Asked by At

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:

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:

  1. Install the dependencies with npm install
  2. Build the application with npm run build
  3. Open dist/index.html in an editor
  4. You will see <%= title %> was not replaced by Some title written in English (Great Britain)
0

There are 0 best solutions below