html-webpack-plugin minify included html files

Viewed 1374

I'm trying to minify included HTML files. My templates looks like this:

<%- include ../header.html %>
<div class="container">
 <h1><%- pageTitle %></h1>
</div>
<%- include( '/footer.html')%>

My webpack config is:

new HtmlWebpackPlugin({
    filename: 'index.html',
    template: 'src/index.html',
    minify: {
      removeComments: true,
      collapseWhitespace: true,
      conservativeCollapse: true
    },
  chunks: ['main']
}
0 Answers
Related