From 40b410ebb120a5b5c0db3379f8b498af4028d059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arno=C5=A1t=20Dudek?= Date: Tue, 31 Dec 2019 20:01:34 +0100 Subject: [PATCH] docs: Update example for template parameters --- examples/template-parameters/webpack.config.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/template-parameters/webpack.config.js b/examples/template-parameters/webpack.config.js index 55a4aa93..535562b2 100755 --- a/examples/template-parameters/webpack.config.js +++ b/examples/template-parameters/webpack.config.js @@ -11,8 +11,19 @@ module.exports = { }, plugins: [ new HtmlWebpackPlugin({ - templateParameters: { - 'foo': 'bar' + // NOTE if you pass plain object it will be passed as is. no default values there, so be aware! + // for implementation detail, please see index.js and search for "userOptions" variable + templateParameters: (compilation, assets, assetTags, options) => { + return { + compilation, + webpackConfig: compilation.options, + htmlWebpackPlugin: { + tags: assetTags, + files: assets, + options + }, + 'foo': 'bar' + }; }, template: 'index.ejs' })