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.
Files changed (3) hide show
  1. package/README.md +19 -12
  2. package/cli.js +3 -1
  3. 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, like [HTML Minifier Terser](https://github.com/terser/html-minifier-terser), [htmlnano](https://github.com/posthtml/htmlnano), [@swc/html](https://github.com/swc-project/swc), [minify-html](https://github.com/wilsonzlin/minify-html), [minimize](https://github.com/Swaagie/minimize), and [htmlcompressor.com](https://htmlcompressor.com/)? (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.)
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 | html­com­pressor.­com |
229
+ | Site | Original Size (KB) | [HTML Minifier Next](https://github.com/j9t/html-minifier-next)<br>![npm last update](https://img.shields.io/npm/last-update/html-minifier-next) | [HTML Minifier Terser](https://github.com/terser/html-minifier-terser)<br>![npm last update](https://img.shields.io/npm/last-update/html-minifier-terser) | [htmlnano](https://github.com/posthtml/htmlnano)<br>![npm last update](https://img.shields.io/npm/last-update/htmlnano) | [@swc/html](https://github.com/swc-project/swc)<br>![npm last update](https://img.shields.io/npm/last-update/@swc/html) | [minify-html](https://github.com/wilsonzlin/minify-html)<br>![npm last update](https://img.shields.io/npm/last-update/@minify-html/node) | [minimize](https://github.com/Swaagie/minimize)<br>![npm last update](https://img.shields.io/npm/last-update/minimize) | [html­com­pressor.­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/) | 185 | **144** | **144** | 163 | 166 | 167 | 171 | 169 |
233
- | [BBC](https://www.bbc.co.uk/) | 712 | **646** | 656 | 668 | 669 | 670 | 706 | n/a |
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/) | 1530 | 1425 | 1430 | **1375** | 1456 | 1467 | 1478 | n/a |
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/) | 1503 | **1287** | 1290 | 1385 | 1407 | 1413 | 1490 | n/a |
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
- | [Leanpub](https://leanpub.com/) | 1723 | **1472** | **1472** | 1479 | 1478 | 1473 | 1718 | n/a |
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 | 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** | | 388 ms (17/17) | 434 ms (17/17) | 219 ms (17/17) | 83 ms (17/17) | **21 ms (17/17)** | 455 ms (17/17) | 1348 ms (11/17) |
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 6, 2025)
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 install
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 (content) { // Minifying one or more files specified on the CMD line
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
@@ -84,5 +84,5 @@
84
84
  "test:watch": "node --test --watch tests/*.spec.js"
85
85
  },
86
86
  "type": "module",
87
- "version": "4.7.0"
87
+ "version": "4.7.1"
88
88
  }