html-minifier-next 2.0.0 → 2.1.2

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 (2) hide show
  1. package/README.md +26 -25
  2. package/package.json +2 -4
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # HTML Minifier Next
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/html-minifier-next.svg)](https://www.npmjs.com/package/html-minifier-next)
4
- [![Build Status](https://github.com/j9t/html-minifier-next/workflows/CI/badge.svg)](https://github.com/j9t/html-minifier-next/actions?workflow=CI)
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 is a highly **configurable, well-tested, JavaScript-based HTML minifier**.
6
+ HTML Minifier Next is a highly **configurable, well-tested, JavaScript-based HTML minifier**.
7
7
 
8
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.
9
9
 
@@ -127,26 +127,27 @@ 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 compare to other solutions, like [minimize](https://github.com/Swaagie/minimize) or [htmlcompressor.com](http://htmlcompressor.com/)?
131
-
132
- | Site | Original size (KB) | HTMLMinifier | minimize | htmlcompressor.com |
133
- | --- | --- | --- | --- | --- |
134
- | [A List Apart](https://alistapart.com/) | 64 | **54** | 59 | 57 |
135
- | [Amazon](https://www.amazon.com/) | 707 | **635** | 693 | n/a |
136
- | [BBC](https://www.bbc.co.uk/) | 700 | **642** | 694 | n/a |
137
- | [CSS-Tricks](https://css-tricks.com/) | 167 | **124** | 153 | 149 |
138
- | [ECMAScript](https://tc39.es/ecma262/) | 7205 | **6365** | 6585 | n/a |
139
- | [EFF](https://www.eff.org/) | 58 | **49** | 52 | 52 |
140
- | [Eloquent JavaScript](https://eloquentjavascript.net/) | 6 | **5** | 6 | 5 |
141
- | [FAZ](https://www.faz.net/aktuell/) | 1848 | **1727** | 1763 | n/a |
142
- | [Frontend Dogma](https://frontenddogma.com/) | 118 | **113** | 127 | 117 |
143
- | [Google](https://www.google.com/) | 50 | **46** | 50 | 50 |
144
- | [HTMLMinifier](https://github.com/kangax/html-minifier) | 371 | **249** | 347 | n/a |
145
- | [Mastodon](https://mastodon.social/explore) | 35 | **26** | 34 | 34 |
146
- | [NBC](https://www.nbc.com/) | 579 | **528** | 572 | n/a |
147
- | [New York Times](https://www.nytimes.com/) | 733 | **625** | 722 | n/a |
148
- | [United Nations](https://www.un.org/) | 9 | **7** | 8 | 8 |
149
- | [W3C](https://www.w3.org/) | 51 | **36** | 42 | 40 |
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)?
131
+
132
+ | Site | Original size (KB) | HTML Minifier Next | minimize | htmlcompressor.com | htmlnano | minify-html |
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 |
150
151
 
151
152
  ## Options quick reference
152
153
 
@@ -217,11 +218,11 @@ SVG elements are automatically recognized, and when they are minified, both case
217
218
 
218
219
  ### Working with invalid markup
219
220
 
220
- HTML Minifier **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.
221
+ 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.
221
222
 
222
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>`)
223
224
 
224
- HTML Minifier 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.
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.
225
226
 
226
227
  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/).
227
228
 
@@ -287,7 +288,7 @@ Benchmarks for minified HTML:
287
288
  ```shell
288
289
  cd benchmarks
289
290
  npm install
290
- npm run benchmark
291
+ npm run benchmarks
291
292
  ```
292
293
 
293
294
  ## Running local server
package/package.json CHANGED
@@ -22,9 +22,7 @@
22
22
  "@rollup/plugin-node-resolve": "^16.0.1",
23
23
  "@rollup/plugin-terser": "^0.4.4",
24
24
  "alpinejs": "^3.14.9",
25
- "commitlint-config-non-conventional": "^1.0.1",
26
25
  "eslint": "^9.33.0",
27
- "husky": "^9.1.7",
28
26
  "jest": "^30.1.3",
29
27
  "rollup": "^4.50.0",
30
28
  "rollup-plugin-polyfill-node": "^0.13.0",
@@ -82,11 +80,11 @@
82
80
  "deploy": "npm run build && npm run build:docs",
83
81
  "lint": "eslint .",
84
82
  "prepack": "npm run build",
85
- "prepare": "husky",
83
+ "prepare": "git config core.hooksPath .githooks || true",
86
84
  "serve": "npm run build && vite",
87
85
  "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
88
86
  "test:watch": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest --watch"
89
87
  },
90
88
  "type": "module",
91
- "version": "2.0.0"
89
+ "version": "2.1.2"
92
90
  }