html-minifier-next 1.1.0 → 1.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,7 +3,7 @@
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
- (This project is based on [Terser’s html-minifier-terser](https://github.com/terser/html-minifier-terser), which in turn is based on [Juriy Zaytsev’s html-minifier](https://github.com/kangax/html-minifier). It was set up because as of May 2025, both html-minifier-terser and html-minifier seem unmaintained. **This project is currently under test.** If it seems maintainable to me, [Jens](https://meiert.com/), even without community support, the project will be updated and documented further. The following documentation largely matches the original project.)
6
+ (This 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. For the time being, the following documentation largely matches the original project.)
7
7
 
8
8
  HTMLMinifier is a highly **configurable, well-tested, JavaScript-based HTML minifier**.
9
9
 
@@ -30,7 +30,7 @@ For command line usage please see `html-minifier-next --help` for a list of avai
30
30
  **Sample command line:**
31
31
 
32
32
  ```bash
33
- html-minifier-next --collapse-whitespace --remove-comments --minify-js true
33
+ html-minifier-next --collapse-whitespace --remove-comments --minify-js true --input-dir=. --output-dir=example
34
34
  ```
35
35
 
36
36
  ### Node.js
@@ -44,29 +44,29 @@ const result = await minify('<p title="blah" id="moo">foo</p>', {
44
44
  result; // '<p title=blah id=moo>foo</p>'
45
45
  ```
46
46
 
47
- See [the origina blog post](http://perfectionkills.com/experimenting-with-html-minifier) for details of [how it works](http://perfectionkills.com/experimenting-with-html-minifier#how_it_works), [description of each option](http://perfectionkills.com/experimenting-with-html-minifier#options), [testing results](http://perfectionkills.com/experimenting-with-html-minifier#field_testing), and [conclusions](http://perfectionkills.com/experimenting-with-html-minifier#cost_and_benefits).
47
+ See [the original blog post](http://perfectionkills.com/experimenting-with-html-minifier) for details of [how it works](http://perfectionkills.com/experimenting-with-html-minifier#how_it_works), [description of each option](http://perfectionkills.com/experimenting-with-html-minifier#options), [testing results](http://perfectionkills.com/experimenting-with-html-minifier#field_testing), and [conclusions](http://perfectionkills.com/experimenting-with-html-minifier#cost_and_benefits).
48
48
 
49
49
  For lint-like capabilities take a look at [HTMLLint](https://github.com/kangax/html-lint).
50
50
 
51
51
  ## Minification comparison
52
52
 
53
- How does HTMLMinifier compare to other solutions [HTML Minifier from Will Peavy](http://www.willpeavy.com/minifier/) (1st result in [Google search for “html minifier”](https://www.google.com/#q=html+minifier)) as well as [htmlcompressor.com](http://htmlcompressor.com) and [minimize](https://github.com/Swaagie/minimize)?
53
+ How does HTMLMinifier compare to other solutions—[HTML Minifier from Will Peavy](http://www.willpeavy.com/minifier/) (1st result in [Google search for “html minifier”](https://www.google.com/#q=html+minifier)) as well as [htmlcompressor.com](http://htmlcompressor.com) and [minimize](https://github.com/Swaagie/minimize)?
54
54
 
55
55
  | Site | Original size (KB) | HTMLMinifier | minimize | htmlcompressor.com |
56
56
  | --- | --- | --- | --- | --- |
57
- | [Amazon](https://www.amazon.com/) | 6 | **4** | 4 | n/a |
58
- | [BBC](https://www.bbc.co.uk/) | 759 | **699** | 752 | n/a |
59
- | [ECMAScript](https://tc39.es/ecma262/) | 7195 | **6352** | 6571 | n/a |
57
+ | [Amazon](https://www.amazon.com/) | 695 | **625** | 682 | n/a |
58
+ | [BBC](https://www.bbc.co.uk/) | 655 | **602** | 649 | n/a |
59
+ | [ECMAScript](https://tc39.es/ecma262/) | 7197 | **6353** | 6573 | n/a |
60
60
  | [EFF](https://www.eff.org/) | 60 | **51** | 54 | n/a |
61
61
  | [Eloquent JavaScript](https://eloquentjavascript.net/) | 6 | **5** | 6 | n/a |
62
- | [FAZ](https://www.faz.net/aktuell/) | 1738 | **1614** | 1649 | n/a |
63
- | [Frontend Dogma](https://frontenddogma.com/) | 119 | **115** | 128 | n/a |
64
- | [Google](https://www.google.com/) | 50 | **46** | 50 | n/a |
65
- | [HTMLMinifier](https://github.com/kangax/html-minifier) | 363 | **243** | 341 | n/a |
66
- | [Mastodon](https://mastodon.social/explore) | 22 | **13** | 21 | n/a |
67
- | [NBC](https://www.nbc.com/) | 1204 | **1099** | 1191 | n/a |
68
- | [New York Times](https://www.nytimes.com/) | 900 | **760** | 890 | n/a |
69
- | [United Nations](https://www.un.org/) | 10 | **7** | 8 | n/a |
62
+ | [FAZ](https://www.faz.net/aktuell/) | 1793 | **1667** | 1705 | n/a |
63
+ | [Frontend Dogma](https://frontenddogma.com/) | 116 | **112** | 125 | n/a |
64
+ | [Google](https://www.google.com/) | 51 | **46** | 51 | n/a |
65
+ | [HTMLMinifier](https://github.com/kangax/html-minifier) | 366 | **245** | 343 | n/a |
66
+ | [Mastodon](https://mastodon.social/explore) | 37 | **27** | 36 | n/a |
67
+ | [NBC](https://www.nbc.com/) | 1022 | **932** | 1010 | n/a |
68
+ | [New York Times](https://www.nytimes.com/) | 951 | **809** | 939 | n/a |
69
+ | [United Nations](https://www.un.org/) | 9 | **7** | 8 | n/a |
70
70
  | [W3C](https://www.w3.org/) | 51 | **36** | 42 | n/a |
71
71
  | [Wikipedia](https://en.wikipedia.org/wiki/Main_Page) | 114 | **100** | 107 | n/a |
72
72
 
package/cli.js CHANGED
@@ -94,9 +94,7 @@ function parseJSONRegExpArray(value) {
94
94
  return value && value.map(parseRegExp);
95
95
  }
96
96
 
97
- function parseString(value) {
98
- return value;
99
- }
97
+ const parseString = value => value;
100
98
 
101
99
  const mainOptions = {
102
100
  caseSensitive: 'Treat attributes in case sensitive manner (useful for SVG; e.g. viewBox)',