html-minifier-next 3.2.0 → 3.2.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 (2) hide show
  1. package/README.md +23 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -28,7 +28,7 @@ Use `html-minifier-next --help` to check all available options:
28
28
 
29
29
  | Option | Description | Example |
30
30
  | --- | --- | --- |
31
- | `--input-dir <dir>` | Specify an input directory | `--input-dir=src` |
31
+ | `--input-dir <dir>` | Specify an input directory (best restricted with `--file-ext`) | `--input-dir=src` |
32
32
  | `--output-dir <dir>` | Specify an output directory | `--output-dir=dist` |
33
33
  | `--file-ext <extensions>` | Specify file extension(s) to process (overrides config file setting) | `--file-ext=html`, `--file-ext=html,htm,php`, `--file-ext="html, htm, php"` |
34
34
  | `-o <file>`, `--output <file>` | Specify output file (reads from file arguments or STDIN) | File to file: `html-minifier-next input.html -o output.html`<br>Pipe to file: `cat input.html \| html-minifier-next -o output.html`<br>File to STDOUT: `html-minifier-next input.html` |
@@ -111,9 +111,9 @@ Options can be used in config files (camelCase) or via CLI flags (kebab-case wit
111
111
  | --- | --- | --- |
112
112
  | `caseSensitive`<br>`--case-sensitive` | Treat attributes in case-sensitive manner (useful for custom HTML elements) | `false` |
113
113
  | `collapseBooleanAttributes`<br>`--collapse-boolean-attributes` | [Omit attribute values from boolean attributes](http://perfectionkills.com/experimenting-with-html-minifier#collapse_boolean_attributes) | `false` |
114
- | `collapseInlineTagWhitespace`<br>`--collapse-inline-tag-whitespace` | Don’t leave any spaces between `display: inline;` elements when collapsing—use with `collapseWhitespace=true` | `false` |
114
+ | `collapseInlineTagWhitespace`<br>`--collapse-inline-tag-whitespace` | Don’t leave any spaces between `display: inline;` elements when collapsing—use with `collapseWhitespace: true` | `false` |
115
115
  | `collapseWhitespace`<br>`--collapse-whitespace` | [Collapse whitespace that contributes to text nodes in a document tree](http://perfectionkills.com/experimenting-with-html-minifier#collapse_whitespace) | `false` |
116
- | `conservativeCollapse`<br>`--conservative-collapse` | Always collapse to 1 space (never remove it entirely)—use with `collapseWhitespace=true` | `false` |
116
+ | `conservativeCollapse`<br>`--conservative-collapse` | Always collapse to 1 space (never remove it entirely)—use with `collapseWhitespace: true` | `false` |
117
117
  | `continueOnParseError`<br>`--continue-on-parse-error` | [Handle parse errors](https://html.spec.whatwg.org/multipage/parsing.html#parse-errors) instead of aborting | `false` |
118
118
  | `customAttrAssign`<br>`--custom-attr-assign` | Arrays of regexes that allow to support custom attribute assign expressions (e.g., `<div flex?="{{mode != cover}}"></div>`) | `[]` |
119
119
  | `customAttrCollapse`<br>`--custom-attr-collapse` | Regex that specifies custom attribute to strip newlines from (e.g., `/ng-class/`) | |
@@ -133,7 +133,7 @@ Options can be used in config files (camelCase) or via CLI flags (kebab-case wit
133
133
  | `minifyJS`<br>`--minify-js` | Minify JavaScript in `script` elements and event attributes (uses [Terser](https://github.com/terser/terser)) | `false` (could be `true`, `Object`, `Function(text, inline)`) |
134
134
  | `minifyURLs`<br>`--minify-urls` | Minify URLs in various attributes (uses [relateurl](https://github.com/stevenvachon/relateurl)) | `false` (could be `String`, `Object`, `Function(text)`, `async Function(text)`) |
135
135
  | `noNewlinesBeforeTagClose`<br>`--no-newlines-before-tag-close` | Never add a newline before a tag that closes an element | `false` |
136
- | `preserveLineBreaks`<br>`--preserve-line-breaks` | Always collapse to 1 line break (never remove it entirely) when whitespace between tags includes a line break—use with `collapseWhitespace=true` | `false` |
136
+ | `preserveLineBreaks`<br>`--preserve-line-breaks` | Always collapse to 1 line break (never remove it entirely) when whitespace between tags includes a line break—use with `collapseWhitespace: true` | `false` |
137
137
  | `preventAttributesEscaping`<br>`--prevent-attributes-escaping` | Prevents the escaping of the values of attributes | `false` |
138
138
  | `processConditionalComments`<br>`--process-conditional-comments` | Process contents of conditional comments through minifier | `false` |
139
139
  | `processScripts`<br>`--process-scripts` | Array of strings corresponding to types of `script` elements to process through minifier (e.g., `text/ng-template`, `text/x-handlebars-template`, etc.) | `[]` |
@@ -154,7 +154,7 @@ Options can be used in config files (camelCase) or via CLI flags (kebab-case wit
154
154
 
155
155
  ### Sorting attributes and style classes
156
156
 
157
- Minifier options like `sortAttributes` and `sortClassName` won’t impact the plain‑text size of the output. However, they form long, repetitive character chains that should improve the compression ratio of gzip used for HTTP.
157
+ Minifier options like `sortAttributes` and `sortClassName` won’t impact the plain‑text size of the output. However, using these options for more consistent ordering improves the compression ratio for gzip and Brotli used over HTTP.
158
158
 
159
159
  ## Minification comparison
160
160
 
@@ -163,24 +163,24 @@ How does HTML Minifier Next compare to other solutions, like [minimize](https://
163
163
  | Site | Original Size (KB) | HTML Minifier Next | minimize | html­compressor.com | htmlnano | minify-html |
164
164
  | --- | --- | --- | --- | --- | --- | --- |
165
165
  | [A List Apart](https://alistapart.com/) | 62 | **53** | 58 | 56 | 54 | 55 |
166
- | [Amazon](https://www.amazon.com/) | 715 | **642** | 701 | n/a | n/a | n/a |
167
- | [Apple](https://www.apple.com/) | 184 | **143** | 170 | 167 | 161 | 166 |
168
- | [BBC](https://www.bbc.co.uk/) | 618 | **568** | 613 | n/a | 580 | 582 |
169
- | [CSS-Tricks](https://css-tricks.com/) | 161 | **121** | 148 | 145 | 126 | 144 |
166
+ | [Amazon](https://www.amazon.com/) | 206 | **195** | 203 | 200 | 196 | n/a |
167
+ | [Apple](https://www.apple.com/) | 183 | **143** | 169 | 167 | 160 | 166 |
168
+ | [BBC](https://www.bbc.co.uk/) | 689 | **633** | 683 | n/a | 646 | 648 |
169
+ | [CSS-Tricks](https://css-tricks.com/) | 163 | **121** | 149 | 146 | 127 | 145 |
170
170
  | [ECMAScript](https://tc39.es/ecma262/) | 7233 | **6338** | 6610 | n/a | 6557 | 6563 |
171
- | [EFF](https://www.eff.org/) | 57 | **48** | 51 | 51 | 51 | 49 |
172
- | [FAZ](https://www.faz.net/aktuell/) | 1876 | 1753 | 1790 | n/a | **1652** | n/a |
173
- | [Frontend Dogma](https://frontenddogma.com/) | 119 | **114** | 128 | 118 | 125 | 119 |
174
- | [Google](https://www.google.com/) | 18 | **17** | 18 | 18 | **17** | n/a |
175
- | [Ground News](https://ground.news/) | 1840 | **1591** | 1827 | n/a | 1689 | n/a |
171
+ | [EFF](https://www.eff.org/) | 57 | **48** | 52 | 52 | 51 | 50 |
172
+ | [FAZ](https://www.faz.net/aktuell/) | 1871 | 1747 | 1785 | n/a | **1647** | n/a |
173
+ | [Frontend Dogma](https://frontenddogma.com/) | 119 | **114** | 128 | 119 | 126 | 119 |
174
+ | [Google](https://www.google.com/) | 18 | **16** | 18 | 18 | 17 | n/a |
175
+ | [Ground News](https://ground.news/) | 3308 | **2946** | 3295 | n/a | 3042 | n/a |
176
176
  | [HTML](https://html.spec.whatwg.org/multipage/) | 149 | **147** | 155 | 148 | 153 | 149 |
177
- | [Leanpub](https://leanpub.com/) | 1567 | **1292** | 1561 | n/a | 1299 | n/a |
177
+ | [Leanpub](https://leanpub.com/) | 1279 | **1063** | 1274 | n/a | 1070 | n/a |
178
178
  | [Mastodon](https://mastodon.social/explore) | 35 | **26** | 34 | 34 | 30 | 33 |
179
- | [MDN](https://developer.mozilla.org/en-US/) | 104 | **62** | 67 | 68 | 64 | n/a |
180
- | [Middle East Eye](https://www.middleeasteye.net/) | 224 | **197** | 204 | 204 | 204 | 201 |
181
- | [SitePoint](https://www.sitepoint.com/) | 476 | **345** | 473 | n/a | 415 | 456 |
179
+ | [MDN](https://developer.mozilla.org/en-US/) | 107 | **61** | 67 | 67 | 63 | n/a |
180
+ | [Middle East Eye](https://www.middleeasteye.net/) | 224 | **197** | 204 | 205 | 204 | 202 |
181
+ | [SitePoint](https://www.sitepoint.com/) | 485 | **354** | 481 | n/a | 423 | 465 |
182
182
  | [United Nations](https://www.un.org/en/) | 151 | **114** | 130 | 123 | 121 | 124 |
183
- | [W3C](https://www.w3.org/) | 50 | **36** | 41 | 39 | 39 | 39 |
183
+ | [W3C](https://www.w3.org/) | 50 | **36** | 41 | 39 | 38 | 39 |
184
184
 
185
185
  ## Examples
186
186
 
@@ -192,7 +192,7 @@ How does HTML Minifier Next compare to other solutions, like [minimize](https://
192
192
  html-minifier-next --collapse-whitespace --remove-comments --minify-js true --input-dir=. --output-dir=example
193
193
  ```
194
194
 
195
- **Process specific file extensions:**
195
+ **Process specific files and directories:**
196
196
 
197
197
  ```bash
198
198
  # Process only HTML files
@@ -206,7 +206,7 @@ html-minifier-next --config-file=html-minifier.json --input-dir=src --output-dir
206
206
 
207
207
  # Process all files (default behavior)
208
208
  html-minifier-next --collapse-whitespace --input-dir=src --output-dir=dist
209
- # Note: When processing all files, non-HTML files will also be read as UTF‑8 and passed to the minifier
209
+ # When processing all files, non-HTML files will also be read as UTF‑8 and passed to the minifier
210
210
  # Consider restricting with `--file-ext` to avoid touching binaries (e.g., images, archives)
211
211
  ```
212
212
 
@@ -236,7 +236,7 @@ html-minifier-next --input-dir=src --output-dir=dist --verbose --collapse-whites
236
236
  # ---
237
237
  # Total: 3,334 → 2,546 bytes (-788, 23.6%)
238
238
 
239
- # Note: `--dry` automatically enables verbose output
239
+ # `--dry` automatically enables verbose output
240
240
  html-minifier-next --input-dir=src --output-dir=dist --dry --collapse-whitespace
241
241
  ```
242
242
 
@@ -331,7 +331,7 @@ npm install
331
331
  npm run benchmarks
332
332
  ```
333
333
 
334
- ## Local server
334
+ ### Local server
335
335
 
336
336
  ```shell
337
337
  npm run serve
package/package.json CHANGED
@@ -78,5 +78,5 @@
78
78
  "test:watch": "node --test --watch tests/*.spec.js"
79
79
  },
80
80
  "type": "module",
81
- "version": "3.2.0"
81
+ "version": "3.2.1"
82
82
  }