I am using Webpack to compile my scripts and HTML (using html-webpack-plugin
). The thing is, I have 5 HTML files that contains the same parts and I want to move these parts to separate .html
files and then include
these parts in every HTML file. This way, if I will change these smaller HTML files, it will recompile every HTML file to represent these changes.
Webpack does this for .js files by default, but can I use something like that for HTML files?
You can use <%= require('html!./partial.html') %>
in your template. Example here: https://github.com/jantimon/html-webpack-plugin/blob/master/examples/custom-template/template.html