html-minifier-next 2.1.3 → 2.1.4

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 CHANGED
@@ -3,9 +3,9 @@
3
3
  [![npm version](https://img.shields.io/npm/v/html-minifier-next.svg)](https://www.npmjs.com/package/html-minifier-next)
4
4
  [![Build status](https://github.com/j9t/html-minifier-next/workflows/CI/badge.svg)](https://github.com/j9t/html-minifier-next/actions?workflow=CI)
5
5
 
6
- HTML Minifier Next is a highly **configurable, well-tested, JavaScript-based HTML minifier**.
6
+ HTML Minifier Next (HMN) is a highly **configurable, well-tested, JavaScript-based HTML minifier**.
7
7
 
8
- The project has been based on [Terser’s html-minifier-terser](https://github.com/terser/html-minifier-terser), which in turn had been based on [Juriy Zaytsev’s html-minifier](https://github.com/kangax/html-minifier). It was set up because as of 2025, both html-minifier-terser and html-minifier have been unmaintained for some time. As the project seems maintainable [to me, [Jens](https://meiert.com/)]—even more so with community support—, it will be updated and documented further in this place.
8
+ The project has been based on [Terser’s html-minifier-terser](https://github.com/terser/html-minifier-terser), which in turn had been based on [Juriy Zaytsev’s html-minifier](https://github.com/kangax/html-minifier) (HMN offers additional features, but is compatible with both). It was set up because as of 2025, both html-minifier-terser and html-minifier have been unmaintained for some time. As the project seems maintainable [to me, [Jens](https://meiert.com/)]—even more so with community support—, it’s being updated and documented further in this place.
9
9
 
10
10
  ## Installation
11
11
 
@@ -127,27 +127,29 @@ For lint-like capabilities take a look at [HTMLLint](https://github.com/kangax/h
127
127
 
128
128
  ## Minification comparison
129
129
 
130
- How does HTML Minifier Next compare to other solutions, like [minimize](https://github.com/Swaagie/minimize), [htmlcompressor.com](http://htmlcompressor.com/), [htmlnano](https://github.com/posthtml/htmlnano), and [minify-html](https://github.com/wilsonzlin/minify-html)?
130
+ How does HTML Minifier Next compare to other solutions, like [minimize](https://github.com/Swaagie/minimize), [htmlcompressor.com](http://htmlcompressor.com/), [htmlnano](https://github.com/posthtml/htmlnano), and [minify-html](https://github.com/wilsonzlin/minify-html)? (All with the most aggressive settings, but without [hyper-optimization](https://meiert.com/blog/the-ways-of-writing-html/#toc-hyper-optimized).)
131
131
 
132
- | Site | Original size (KB) | HTML Minifier Next | minimize | htmlcompressor.com | htmlnano | minify-html |
132
+ | Site | Original size (KB) | HTML Minifier Next | minimize | html­compressor.com | htmlnano | minify-html |
133
133
  | --- | --- | --- | --- | --- | --- | --- |
134
- | [A List Apart](https://alistapart.com/) | 64 | **54** | 59 | 57 | 59 | 56 |
135
- | [Amazon](https://www.amazon.com/) | 718 | **645** | 704 | n/a | 667 | 683 |
136
- | [BBC](https://www.bbc.co.uk/) | 739 | **678** | 733 | n/a | 709 | 718 |
137
- | [CSS-Tricks](https://css-tricks.com/) | 165 | **123** | 151 | 148 | 136 | 148 |
138
- | [ECMAScript](https://tc39.es/ecma262/) | 7205 | **6365** | 6585 | n/a | 6871 | 6538 |
139
- | [EFF](https://www.eff.org/) | 58 | **49** | 53 | 53 | 55 | 52 |
140
- | [Eloquent JavaScript](https://eloquentjavascript.net/) | 6 | **5** | 6 | 5 | 6 | 5 |
141
- | [FAZ](https://www.faz.net/aktuell/) | 1814 | **1696** | 1730 | n/a | 1623 | 1735 |
142
- | [Frontend Dogma](https://frontenddogma.com/) | 118 | **113** | 127 | 117 | 131 | 117 |
143
- | [Google](https://www.google.com/) | 50 | **46** | 50 | 50 | 48 | 49 |
144
- | [HTML Minifier Next](https://github.com/j9t/html-minifier-next) | 393 | **274** | 371 | n/a | 339 | 359 |
145
- | [Mastodon](https://mastodon.social/explore) | 35 | **26** | 34 | 34 | 31 | 33 |
146
- | [meiert.com](https://meiert.com/) | 25 | **24** | 26 | 25 | 26 | 25 |
147
- | [NBC](https://www.nbc.com/) | 584 | **533** | 576 | n/a | 559 | 571 |
148
- | [New York Times](https://www.nytimes.com/) | 864 | **738** | 852 | n/a | 801 | 848 |
149
- | [United Nations](https://www.un.org/) | 9 | **7** | 8 | 8 | 8 | 7 |
150
- | [W3C](https://www.w3.org/) | 50 | **36** | 41 | 39 | 40 | 41 |
134
+ | [A List Apart](https://alistapart.com/) | 63 | **54** | 58 | 57 | 55 | 56 |
135
+ | [Amazon](https://www.amazon.com/) | 5 | **3** | **3** | **3** | **3** | n/a |
136
+ | [Apple](https://www.apple.com/) | 212 | **171** | 198 | 195 | 189 | 194 |
137
+ | [BBC](https://www.bbc.co.uk/) | 742 | **683** | 736 | n/a | 698 | 699 |
138
+ | [CSS-Tricks](https://css-tricks.com/) | 11 | **6** | 11 | 10 | 7 | n/a |
139
+ | [ECMAScript](https://tc39.es/ecma262/) | 7205 | **6315** | 6585 | n/a | 6532 | 6538 |
140
+ | [EFF](https://www.eff.org/) | 60 | **51** | 55 | 55 | 54 | 53 |
141
+ | [FAZ](https://www.faz.net/aktuell/) | 1847 | 1728 | 1764 | n/a | **1630** | n/a |
142
+ | [Frontend Dogma](https://frontenddogma.com/) | 117 | **112** | 126 | 117 | 124 | 117 |
143
+ | [Google](https://www.google.com/) | 18 | **16** | 17 | 17 | **16** | n/a |
144
+ | [Ground News](https://ground.news/) | 1509 | **1287** | 1495 | n/a | 1386 | n/a |
145
+ | [HTML](https://html.spec.whatwg.org/multipage/) | 149 | **146** | 155 | 148 | 153 | 148 |
146
+ | [Leanpub](https://leanpub.com/) | 1361 | **1143** | 1355 | n/a | 1150 | n/a |
147
+ | [Mastodon](https://mastodon.social/explore) | 35 | **25** | 33 | 33 | 30 | 33 |
148
+ | [MDN](https://developer.mozilla.org/en-US/) | 104 | **62** | 67 | 68 | 64 | n/a |
149
+ | [Middle East Eye](https://www.middleeasteye.net/) | 221 | **194** | 201 | 202 | 201 | 199 |
150
+ | [SitePoint](https://www.sitepoint.com/) | 469 | **338** | 466 | n/a | 408 | 449 |
151
+ | [United Nations](https://www.un.org/en/) | 153 | **116** | 132 | 125 | 123 | 127 |
152
+ | [W3C](https://www.w3.org/) | 49 | **35** | 40 | 38 | 37 | 38 |
151
153
 
152
154
  ## Options quick reference
153
155
 
@@ -220,9 +222,9 @@ SVG elements are automatically recognized, and when they are minified, both case
220
222
 
221
223
  HTML Minifier Next **can’t work with invalid or partial chunks of markup**. This is because it parses markup into a tree structure, then modifies it (removing anything that was specified for removal, ignoring anything that was specified to be ignored, etc.), then it creates a markup out of that tree and returns it.
222
224
 
223
- Input markup (e.g., `<p id="">foo`) → Internal representation of markup in a form of tree (e.g., `{ tag: "p", attr: "id", children: ["foo"] }`) → Transformation of internal representation (e.g., removal of `id` attribute) → Output of resulting markup (e.g., `<p>foo</p>`)
225
+ _Input markup (e.g., `<p id="">foo`) → Internal representation of markup in a form of tree (e.g., `{ tag: "p", attr: "id", children: ["foo"] }`) → Transformation of internal representation (e.g., removal of `id` attribute) → Output of resulting markup (e.g., `<p>foo</p>`)_
224
226
 
225
- HTML Minifier Next can’t know that the original markup represented only part of the tree. It parses a complete tree and, in doing so, loses information about the input being malformed or partial. As a result, it can’t emit a partial or malformed tree.
227
+ HMN can’t know that the original markup represented only part of the tree. It parses a complete tree and, in doing so, loses information about the input being malformed or partial. As a result, it can’t emit a partial or malformed tree.
226
228
 
227
229
  To validate HTML markup, use [the W3C validator](https://validator.w3.org/) or one of [several validator packages](https://meiert.com/blog/html-validator-packages/).
228
230
 
package/cli.js CHANGED
@@ -33,7 +33,6 @@ import { Command } from 'commander';
33
33
  import { minify } from './src/htmlminifier.js';
34
34
 
35
35
  const require = createRequire(import.meta.url);
36
-
37
36
  const pkg = require('./package.json');
38
37
 
39
38
  const program = new Command();
@@ -21,7 +21,7 @@ async function replaceAsync(str, regex, asyncFn) {
21
21
 
22
22
  /*!
23
23
  * HTML Parser By John Resig (ejohn.org)
24
- * Modified by Juriy "kangax" Zaytsev
24
+ * Modified by Juriy kangax Zaytsev
25
25
  * Original code by Erik Arvidsson, Mozilla Public License
26
26
  * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
27
27
  */
@@ -60211,7 +60211,7 @@ async function replaceAsync(str, regex, asyncFn) {
60211
60211
 
60212
60212
  /*!
60213
60213
  * HTML Parser By John Resig (ejohn.org)
60214
- * Modified by Juriy "kangax" Zaytsev
60214
+ * Modified by Juriy kangax Zaytsev
60215
60215
  * Original code by Erik Arvidsson, Mozilla Public License
60216
60216
  * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
60217
60217
  */
@@ -60217,7 +60217,7 @@
60217
60217
 
60218
60218
  /*!
60219
60219
  * HTML Parser By John Resig (ejohn.org)
60220
- * Modified by Juriy "kangax" Zaytsev
60220
+ * Modified by Juriy kangax Zaytsev
60221
60221
  * Original code by Erik Arvidsson, Mozilla Public License
60222
60222
  * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
60223
60223
  */