Comments (5)
Related issue: kangax/html-minifier#1092.
from html-minifier-terser.
Since this is documented, can be tested on https://terser.org/html-minifier-terser/ and there is also a way to prevent all optimizations (https://github.com/terser/html-minifier-terser#ignoring-chunks-of-markup) I'm closing this issue.
There are good reasons why all optimizations are disabled by default and why this is in red:
Option | Description | Default |
---|---|---|
removeEmptyElements | Remove all elements with empty contents | false |
from html-minifier-terser.
Ignoring chunks of markup is fine, so long as you are authoring the HTML in question. Otherwise, one needs to dynamically modify the received markup in order to preserve empty elements in SVG.
from html-minifier-terser.
True. Normally this is done in webpack setups with the right plugins which replace texts or before compilation using sed
or other solutions.
In general this case is currently not covered by the tests as it is not recommended to enable removeEmptyElements
since this can break and will break things.
So far only html elements are not affected by this:
https://github.com/terser/html-minifier-terser/blob/v6.0.2/src/htmlminifier.js#L429
https://github.com/terser/html-minifier-terser/blob/v6.0.2/src/htmlminifier.js#L1134
https://github.com/terser/html-minifier-terser/blob/v6.0.2/src/htmlminifier.js#L517-L545
I'm not sure if it makes sense to add svg and xml elements to this function by default but this could lead to the case, that we will have to add many more tags to this function to prevent such issues and that this has to be correctly tested.
But as this is marked as red / breaking, I'm opting for keeping as it is and removing the option from the CLI like you already did.
If this is not in your interest, you may want to check https://github.com/tdewolff/minify#html
https://go.tacodewolff.nl/minify
from html-minifier-terser.
Thanks for the details and links. :)
from html-minifier-terser.
Related Issues (20)
- [Bug]: JUST FULLY ERR! HOT 4
- Minify JSON-LD HOT 4
- Upgrade `clean-css` To `v5.3`
- Remove some legacy things? HOT 1
- [Bug]: `<!--#-->` comments are not removed
- [Feature request]: Preserve EOF newline for Unix file format
- Src included in build? HOT 2
- [Feature Request] Typescript types
- wrap each col element in a colgroup when render col in a separate function HOT 1
- [Bug]: Can't be used in the browser HOT 2
- <code> tag
- [Bug]: bug with ejs template engine
- Feature request: Option for adding comment/copyright/disclaimer text to source code HOT 2
- [Bug]: Remove redundant attributes should support <img> loading attribute
- Support <script type="importmap">
- [Bug]: engine field and workflow matrix could be updated
- [Bug]: Scripts minfiier has cloned variable names that crashes program when mange is activated HOT 3
- Please Consider `cssnano` Instead of `clean-css` HOT 3
- [Bug]: Error Minimizing JSON File HOT 1
- [Bug]: Nested CSS, parent is lost
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-minifier-terser.