jantimon/html-webpack-plugin

html-webpack-plugin, html-loader and partials

staixe opened this issue · 1 comments

Description

I want to split my template and render header.html and footer.html.

In the file where I need to connect the part, I make a call as in the example

<%= require('html-loader!./parts/header.html').default %>

And such a call generates me the correct html file.

But I don't want it to be compressed.

I tried to just connect the html-loader in the file webpack.config.js

{ test: /\.(html)$/, loader: "html-loader" }

In this case, part of the file is not included, and the resulting file remains

<%= require('html-loader!./parts/header.html').default %>

How can I disable file compression? Is it possible to connect parts via webpack.config.js? Can you bring an example?

Because it is bundling, you will compress all or nothing, you can't partial compress, there is only wat to prevent it - using ignoreCustomFragments https://github.com/terser/html-minifier-terser or put <!-- htmlmin:ignore -->. comments on required places