Skip to content

Commit 40b410e

Browse files
dudekaajantimon
authored andcommitted
docs: Update example for template parameters
1 parent bf017f3 commit 40b410e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

examples/template-parameters/webpack.config.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,19 @@ module.exports = {
1111
},
1212
plugins: [
1313
new HtmlWebpackPlugin({
14-
templateParameters: {
15-
'foo': 'bar'
14+
// NOTE if you pass plain object it will be passed as is. no default values there, so be aware!
15+
// for implementation detail, please see index.js and search for "userOptions" variable
16+
templateParameters: (compilation, assets, assetTags, options) => {
17+
return {
18+
compilation,
19+
webpackConfig: compilation.options,
20+
htmlWebpackPlugin: {
21+
tags: assetTags,
22+
files: assets,
23+
options
24+
},
25+
'foo': 'bar'
26+
};
1627
},
1728
template: 'index.ejs'
1829
})

0 commit comments

Comments
 (0)