Skip to content

Instantly share code, notes, and snippets.

@prasann
Created June 11, 2018 11:09
Show Gist options
  • Save prasann/cc797f4ab0715e7696d946647668d43b to your computer and use it in GitHub Desktop.
Save prasann/cc797f4ab0715e7696d946647668d43b to your computer and use it in GitHub Desktop.
A sample webpack config to have multiple html generated using HTMLWebpackPlugin
const templateFileMapper = [{template: "temp1.hbs", file: "temp1.html"},
{template: "temp2.hbs", file: "temp2.html"},
{template: "temp3.hbs", file: "temp3.html"}];
const htmlPlugins = () => {
return templateFileMapper.map(entry => {
return new HtmlWebpackPlugin({
template: entry.template,
filename: entry.file,
});
})
};
module.exports = {
...
plugins: htmlPlugins().concat([otherplugins]),
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment