html-minifier-next 4.7.0 → 4.7.1
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 -12
- package/cli.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -223,31 +223,36 @@ const result = await minify(html, {
|
|
|
223
223
|
|
|
224
224
|
## Minification comparison
|
|
225
225
|
|
|
226
|
-
How does HTML Minifier Next compare to other minifiers
|
|
226
|
+
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). Minimize does not minify CSS or JS.)
|
|
227
227
|
|
|
228
228
|
<!-- Auto-generated benchmarks, don’t edit -->
|
|
229
|
-
| Site | Original Size (KB) | HTML Minifier Next | HTML Minifier Terser | htmlnano | @swc/html | minify-html | minimize | htmlcompressor.com |
|
|
229
|
+
| Site | Original Size (KB) | [HTML Minifier Next](https://github.com/j9t/html-minifier-next)<br> | [HTML Minifier Terser](https://github.com/terser/html-minifier-terser)<br> | [htmlnano](https://github.com/posthtml/htmlnano)<br> | [@swc/html](https://github.com/swc-project/swc)<br> | [minify-html](https://github.com/wilsonzlin/minify-html)<br> | [minimize](https://github.com/Swaagie/minimize)<br> | [htmlcompressor.com](https://htmlcompressor.com/) |
|
|
230
230
|
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
231
231
|
| [A List Apart](https://alistapart.com/) | 59 | **49** | 50 | 51 | 52 | 51 | 54 | 52 |
|
|
232
|
-
| [Apple](https://www.apple.com/) |
|
|
233
|
-
| [BBC](https://www.bbc.co.uk/) |
|
|
232
|
+
| [Apple](https://www.apple.com/) | 181 | **140** | **140** | 159 | 162 | 163 | 167 | 165 |
|
|
233
|
+
| [BBC](https://www.bbc.co.uk/) | 728 | **662** | 672 | 684 | 684 | 685 | 721 | n/a |
|
|
234
234
|
| [CSS-Tricks](https://css-tricks.com/) | 161 | 121 | **119** | 127 | 142 | 142 | 147 | 144 |
|
|
235
235
|
| [ECMAScript](https://tc39.es/ecma262/) | 7237 | **6341** | **6341** | 6561 | 6444 | 6567 | 6614 | n/a |
|
|
236
236
|
| [EFF](https://www.eff.org/) | 55 | **47** | **47** | 49 | 48 | 49 | 50 | 50 |
|
|
237
|
-
| [FAZ](https://www.faz.net/aktuell/) |
|
|
237
|
+
| [FAZ](https://www.faz.net/aktuell/) | 1487 | 1386 | 1391 | **1338** | 1416 | 1426 | 1437 | n/a |
|
|
238
238
|
| [Frontend Dogma](https://frontenddogma.com/) | 221 | **212** | **212** | 233 | 218 | 220 | 238 | 219 |
|
|
239
239
|
| [Google](https://www.google.com/) | 18 | **17** | **17** | **17** | **17** | **17** | 18 | 18 |
|
|
240
|
-
| [Ground News](https://ground.news/) |
|
|
240
|
+
| [Ground News](https://ground.news/) | 2345 | **2060** | 2063 | 2155 | 2176 | 2181 | 2332 | n/a |
|
|
241
241
|
| [HTML Living Standard](https://html.spec.whatwg.org/multipage/) | 149 | **147** | **147** | 153 | **147** | 149 | 155 | 149 |
|
|
242
|
-
| [
|
|
242
|
+
| [Igalia](https://www.igalia.com/) | 49 | **33** | **33** | 35 | 35 | 35 | 36 | 36 |
|
|
243
|
+
| [Leanpub](https://leanpub.com/) | 1405 | **1185** | **1185** | 1192 | 1190 | 1187 | 1399 | n/a |
|
|
243
244
|
| [Mastodon](https://mastodon.social/explore) | 35 | **26** | **26** | 30 | 33 | 33 | 34 | 34 |
|
|
244
|
-
| [MDN](https://developer.mozilla.org/en-US/) | 107 | **62** | **62** | 64 | 64 | 65 | 67 |
|
|
245
|
+
| [MDN](https://developer.mozilla.org/en-US/) | 107 | **62** | **62** | 64 | 64 | 65 | 67 | 68 |
|
|
246
|
+
| [Middle East Eye](https://www.middleeasteye.net/) | 222 | **195** | **195** | 202 | 200 | 200 | 202 | 203 |
|
|
247
|
+
| [Nielsen Norman Group](https://www.nngroup.com/) | 84 | 71 | 71 | **53** | 71 | 72 | 74 | 73 |
|
|
245
248
|
| [SitePoint](https://www.sitepoint.com/) | 508 | **366** | **366** | 444 | 482 | 486 | 504 | n/a |
|
|
249
|
+
| [TetraLogical](https://tetralogical.com/) | 44 | 38 | 38 | **35** | 38 | 38 | 39 | 39 |
|
|
250
|
+
| [TPGi](https://www.tpgi.com/) | 99 | **79** | **79** | 84 | 84 | 84 | 88 | 86 |
|
|
246
251
|
| [United Nations](https://www.un.org/en/) | 153 | **114** | 116 | 123 | 127 | 126 | 132 | 125 |
|
|
247
252
|
| [W3C](https://www.w3.org/) | 50 | **36** | **36** | 38 | 38 | 38 | 40 | 38 |
|
|
248
|
-
| **Average processing time** | |
|
|
253
|
+
| **Average processing time** | | 336 ms (22/22) | 374 ms (22/22) | 188 ms (22/22) | 70 ms (22/22) | **17 ms (22/22)** | 366 ms (22/22) | 1351 ms (16/22) |
|
|
249
254
|
|
|
250
|
-
(Last updated: Dec
|
|
255
|
+
(Last updated: Dec 7, 2025)
|
|
251
256
|
<!-- End auto-generated -->
|
|
252
257
|
|
|
253
258
|
## Examples
|
|
@@ -400,11 +405,13 @@ npm run serve
|
|
|
400
405
|
Benchmarks for minified HTML:
|
|
401
406
|
|
|
402
407
|
```shell
|
|
403
|
-
cd benchmarks
|
|
404
|
-
npm
|
|
408
|
+
cd benchmarks;
|
|
409
|
+
npm i;
|
|
405
410
|
npm run benchmarks
|
|
406
411
|
```
|
|
407
412
|
|
|
413
|
+
(In case of dependency conflicts, run `npm i` with the `--legacy-peer-deps` flag.)
|
|
414
|
+
|
|
408
415
|
## Acknowledgements
|
|
409
416
|
|
|
410
417
|
With many thanks to all the previous authors of HTML Minifier, especially [Juriy Zaytsev](https://github.com/kangax), and to everyone who helped make this new edition better, particularly [Daniel Ruf](https://github.com/DanielRuf) and [Jonas Geiler](https://github.com/jonasgeiler).
|
package/cli.js
CHANGED
|
@@ -258,8 +258,10 @@ program.option('--file-ext <extensions>', 'Specify file extension(s) to process
|
|
|
258
258
|
|
|
259
259
|
(async () => {
|
|
260
260
|
let content;
|
|
261
|
+
let filesProvided = false;
|
|
261
262
|
await program.arguments('[files...]').action(function (files) {
|
|
262
263
|
content = files.map(readFile).join('');
|
|
264
|
+
filesProvided = files.length > 0;
|
|
263
265
|
}).parseAsync(process.argv);
|
|
264
266
|
|
|
265
267
|
const programOptions = program.opts();
|
|
@@ -616,7 +618,7 @@ program.option('--file-ext <extensions>', 'Specify file extension(s) to process
|
|
|
616
618
|
console.error(`Total: ${totalOriginal.toLocaleString()} → ${totalMinified.toLocaleString()} bytes (${sign}${Math.abs(totalSaved).toLocaleString()}, ${totalPercentage}%)`);
|
|
617
619
|
}
|
|
618
620
|
})();
|
|
619
|
-
} else if (
|
|
621
|
+
} else if (filesProvided) { // Minifying one or more files specified on the CMD line
|
|
620
622
|
writeMinify();
|
|
621
623
|
} else { // Minifying input coming from STDIN
|
|
622
624
|
content = '';
|
package/package.json
CHANGED