terser / html-minifier-terser

actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code
https://terser.org/html-minifier-terser
MIT License
376 stars 30 forks source link

Why not provide a specific property to clear the html source tag? #62

Closed ZLhake closed 3 years ago

ZLhake commented 3 years ago

please provide a property to clear the html tag,such as 'removeTags' ,we can use this property to remove some tag content that we do not need In the compiled html file

DanielRuf commented 3 years ago

Hi,

what exactly would be the use case? html-minifier does not remove unwanted tags and is mainly for minifying code (that's why it is called minifier).

Removing whole elements with contents is out of scope of this library.

ZLhake commented 3 years ago

Hi,

what exactly would be the use case? html-minifier does not remove unwanted tags and is mainly for minifying code (that's why it is called minifier).

Removing whole elements with contents is out of scope of this library. First of all, thank you for your reply. In our project, it is a multi-page project. Our scripts are introduced in the head of HTML, so we don’t need to package and compile during development, and can run directly in the browser, but Our project needs to be packaged before it goes online. When packaging, you need to comment out all the script and link tags in the HTML, and then package and compile through webpack. Because there are too many pages, the operation is too troublesome, so we hope to provide such a method to facilitate our operation

DanielRuf commented 3 years ago

This sounds more like a webpack configuration issue and there are webpack plugins to replace / remove elements during compilation.

https://www.google.com/search?channel=fs&q=webpack+replace+plugin

DanielRuf commented 3 years ago

Closing as this is not planned as feature in html-minifier(-terser).