html-minifier-next 4.12.2 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/dist/htmlminifier.cjs +1477 -1313
- package/dist/htmlminifier.esm.bundle.js +4137 -3973
- package/dist/types/htmlminifier.d.ts.map +1 -1
- package/dist/types/htmlparser.d.ts.map +1 -1
- package/dist/types/lib/attributes.d.ts +29 -0
- package/dist/types/lib/attributes.d.ts.map +1 -0
- package/dist/types/lib/constants.d.ts +83 -0
- package/dist/types/lib/constants.d.ts.map +1 -0
- package/dist/types/lib/content.d.ts +7 -0
- package/dist/types/lib/content.d.ts.map +1 -0
- package/dist/types/lib/elements.d.ts +39 -0
- package/dist/types/lib/elements.d.ts.map +1 -0
- package/dist/types/lib/options.d.ts +17 -0
- package/dist/types/lib/options.d.ts.map +1 -0
- package/dist/types/lib/utils.d.ts +21 -0
- package/dist/types/lib/utils.d.ts.map +1 -0
- package/dist/types/lib/whitespace.d.ts +7 -0
- package/dist/types/lib/whitespace.d.ts.map +1 -0
- package/dist/types/presets.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/htmlminifier.js +91 -1226
- package/src/htmlparser.js +11 -11
- package/src/lib/attributes.js +511 -0
- package/src/lib/constants.js +213 -0
- package/src/lib/content.js +105 -0
- package/src/lib/elements.js +242 -0
- package/src/lib/index.js +20 -0
- package/src/lib/options.js +252 -0
- package/src/lib/utils.js +90 -0
- package/src/lib/whitespace.js +139 -0
- package/src/presets.js +0 -1
- package/src/tokenchain.js +1 -1
- package/dist/types/utils.d.ts +0 -2
- package/dist/types/utils.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -230,40 +230,40 @@ const result = await minify(html, {
|
|
|
230
230
|
|
|
231
231
|
## Minification comparison
|
|
232
232
|
|
|
233
|
-
How does HTML Minifier Next compare to other minifiers? (All with the most aggressive settings
|
|
233
|
+
How does HTML Minifier Next compare to other minifiers? (All with the most aggressive settings—though without [hyper-optimization](https://meiert.com/blog/the-ways-of-writing-html/#toc-hyper-optimized)—and against some large documents.—Minimize does not minify CSS or JS.)
|
|
234
234
|
|
|
235
235
|
<!-- Auto-generated benchmarks, don’t edit -->
|
|
236
236
|
| Site | Original Size (KB) | [HTML Minifier Next](https://github.com/j9t/html-minifier-next)<br>[](https://socket.dev/npm/package/html-minifier-next) | [HTML Minifier Terser](https://github.com/terser/html-minifier-terser)<br>[](https://socket.dev/npm/package/html-minifier-terser) | [htmlnano](https://github.com/posthtml/htmlnano)<br>[](https://socket.dev/npm/package/htmlnano) | [@swc/html](https://github.com/swc-project/swc)<br>[](https://socket.dev/npm/package/@swc/html) | [minify-html](https://github.com/wilsonzlin/minify-html)<br>[](https://socket.dev/npm/package/@minify-html/node) | [minimize](https://github.com/Swaagie/minimize)<br>[](https://socket.dev/npm/package/minimize) | [htmlcompressor.com](https://htmlcompressor.com/) |
|
|
237
237
|
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
238
238
|
| [A List Apart](https://alistapart.com/) | 59 | **49** | 50 | 51 | 52 | 51 | 54 | 52 |
|
|
239
239
|
| [Apple](https://www.apple.com/) | 266 | **207** | **207** | 236 | 239 | 240 | 242 | 243 |
|
|
240
|
-
| [BBC](https://www.bbc.co.uk/) |
|
|
241
|
-
| [CERN](https://home.cern/) |
|
|
242
|
-
| [CSS-Tricks](https://css-tricks.com/) |
|
|
243
|
-
| [ECMAScript](https://tc39.es/ecma262/) |
|
|
240
|
+
| [BBC](https://www.bbc.co.uk/) | 740 | **672** | 682 | 694 | 695 | 696 | 733 | n/a |
|
|
241
|
+
| [CERN](https://home.cern/) | 152 | 85 | **84** | 91 | 91 | 91 | 93 | 96 |
|
|
242
|
+
| [CSS-Tricks](https://css-tricks.com/) | 162 | 121 | **120** | 127 | 143 | 143 | 148 | 145 |
|
|
243
|
+
| [ECMAScript](https://tc39.es/ecma262/) | 7250 | **6352** | **6352** | 6573 | 6455 | 6578 | 6626 | n/a |
|
|
244
244
|
| [EDRi](https://edri.org/) | 80 | **59** | 60 | 70 | 70 | 71 | 75 | 73 |
|
|
245
|
-
| [EFF](https://www.eff.org/) | 55 | **47** | **47** |
|
|
245
|
+
| [EFF](https://www.eff.org/) | 55 | **47** | **47** | 49 | 48 | 49 | 50 | 50 |
|
|
246
246
|
| [European Alternatives](https://european-alternatives.eu/) | 48 | **30** | **30** | 32 | 32 | 32 | 32 | 32 |
|
|
247
|
-
| [FAZ](https://www.faz.net/aktuell/) |
|
|
248
|
-
| [French Tech](https://lafrenchtech.gouv.fr/) | 152 | **
|
|
249
|
-
| [Frontend Dogma](https://frontenddogma.com/) |
|
|
247
|
+
| [FAZ](https://www.faz.net/aktuell/) | 1595 | 1486 | 1491 | **1429** | 1518 | 1530 | 1541 | n/a |
|
|
248
|
+
| [French Tech](https://lafrenchtech.gouv.fr/) | 152 | **122** | **122** | 126 | 125 | 125 | 132 | 127 |
|
|
249
|
+
| [Frontend Dogma](https://frontenddogma.com/) | 224 | **214** | 216 | 237 | 222 | 224 | 242 | 223 |
|
|
250
250
|
| [Google](https://www.google.com/) | 18 | **17** | **17** | **17** | **17** | **17** | 18 | 18 |
|
|
251
|
-
| [Ground News](https://ground.news/) |
|
|
251
|
+
| [Ground News](https://ground.news/) | 1682 | **1444** | 1447 | 1548 | 1573 | 1578 | 1669 | n/a |
|
|
252
252
|
| [HTML Living Standard](https://html.spec.whatwg.org/multipage/) | 149 | **147** | **147** | 153 | **147** | 149 | 155 | 149 |
|
|
253
253
|
| [Igalia](https://www.igalia.com/) | 50 | **34** | **34** | 36 | 36 | 36 | 37 | 37 |
|
|
254
|
-
| [Leanpub](https://leanpub.com/) |
|
|
255
|
-
| [Mastodon](https://mastodon.social/explore) | 37 | **
|
|
254
|
+
| [Leanpub](https://leanpub.com/) | 1551 | **1301** | **1301** | 1308 | 1306 | 1303 | 1545 | n/a |
|
|
255
|
+
| [Mastodon](https://mastodon.social/explore) | 37 | **28** | **28** | 32 | 35 | 35 | 36 | 36 |
|
|
256
256
|
| [MDN](https://developer.mozilla.org/en-US/) | 109 | **62** | **62** | 64 | 65 | 65 | 68 | 68 |
|
|
257
|
-
| [Middle East Eye](https://www.middleeasteye.net/) |
|
|
257
|
+
| [Middle East Eye](https://www.middleeasteye.net/) | 222 | **195** | **195** | 202 | 200 | 200 | 202 | 203 |
|
|
258
258
|
| [Nielsen Norman Group](https://www.nngroup.com/) | 86 | 74 | 74 | **55** | 74 | 75 | 77 | 76 |
|
|
259
|
-
| [SitePoint](https://www.sitepoint.com/) |
|
|
260
|
-
| [TetraLogical](https://tetralogical.com/) | 44 | 38 | 38 | **35** | 38 |
|
|
259
|
+
| [SitePoint](https://www.sitepoint.com/) | 501 | **370** | **370** | 442 | 475 | 480 | 498 | n/a |
|
|
260
|
+
| [TetraLogical](https://tetralogical.com/) | 44 | 38 | 38 | **35** | 38 | 39 | 39 | 39 |
|
|
261
261
|
| [TPGi](https://www.tpgi.com/) | 175 | **160** | 161 | **160** | 164 | 166 | 172 | 172 |
|
|
262
|
-
| [United Nations](https://www.un.org/en/) |
|
|
263
|
-
| [W3C](https://www.w3.org/) | 50 | **
|
|
264
|
-
| **Average processing time** | |
|
|
262
|
+
| [United Nations](https://www.un.org/en/) | 152 | **113** | 114 | 121 | 125 | 125 | 131 | 124 |
|
|
263
|
+
| [W3C](https://www.w3.org/) | 50 | **36** | **36** | 39 | 38 | 38 | 41 | 39 |
|
|
264
|
+
| **Average processing time** | | 305 ms (26/26) | 361 ms (26/26) | 175 ms (26/26) | 57 ms (26/26) | **17 ms (26/26)** | 313 ms (26/26) | 1442 ms (20/26) |
|
|
265
265
|
|
|
266
|
-
(Last updated: Dec
|
|
266
|
+
(Last updated: Dec 20, 2025)
|
|
267
267
|
<!-- End auto-generated -->
|
|
268
268
|
|
|
269
269
|
## Examples
|