html-minifier-next 4.5.0 → 4.5.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.
- package/README.md +23 -23
- package/dist/htmlminifier.cjs +0 -1
- package/dist/htmlminifier.esm.bundle.js +0 -1
- package/dist/types/presets.d.ts +0 -2
- package/dist/types/presets.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/presets.js +1 -2
package/README.md
CHANGED
|
@@ -72,29 +72,6 @@ html-minifier-next --config-file=html-minifier.json --input-dir=src --output-dir
|
|
|
72
72
|
html-minifier-next --config-file=html-minifier.json --file-ext=xml --input-dir=src --output-dir=dist
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
### Presets
|
|
76
|
-
|
|
77
|
-
HTML Minifier Next provides presets for common use cases. Presets are pre-configured option sets that can be used as a starting point:
|
|
78
|
-
|
|
79
|
-
* `conservative`: Safe minification suitable for most projects. Includes whitespace collapsing, comment removal, and doctype normalization.
|
|
80
|
-
* `comprehensive`: Aggressive minification for maximum file size reduction. Includes all conservative options plus attribute quote removal, optional tag removal, and more.
|
|
81
|
-
|
|
82
|
-
**Using presets:**
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
# Via CLI flag
|
|
86
|
-
html-minifier-next --preset conservative input.html
|
|
87
|
-
|
|
88
|
-
# Via config file
|
|
89
|
-
html-minifier-next --config-file=config.json input.html
|
|
90
|
-
# where config.json contains: { "preset": "conservative" }
|
|
91
|
-
|
|
92
|
-
# Override preset options
|
|
93
|
-
html-minifier-next --preset conservative --remove-empty-attributes input.html
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**Priority order:** Presets are applied first, then config file options, then CLI flags. This allows you to start with a preset and customize as needed.
|
|
97
|
-
|
|
98
75
|
### Node.js
|
|
99
76
|
|
|
100
77
|
ESM with Node.js ≥16.14:
|
|
@@ -125,6 +102,29 @@ See [the original blog post](https://perfectionkills.com/experimenting-with-html
|
|
|
125
102
|
|
|
126
103
|
For lint-like capabilities, take a look at [HTMLLint](https://github.com/kangax/html-lint).
|
|
127
104
|
|
|
105
|
+
## Presets
|
|
106
|
+
|
|
107
|
+
HTML Minifier Next provides presets for common use cases. Presets are pre-configured option sets that can be used as a starting point:
|
|
108
|
+
|
|
109
|
+
* `conservative`: Safe minification suitable for most projects. Includes whitespace collapsing, comment removal, and doctype normalization.
|
|
110
|
+
* `comprehensive`: Aggressive minification for maximum file size reduction. Includes all conservative options plus attribute quote removal, optional tag removal, and more.
|
|
111
|
+
|
|
112
|
+
**Using presets:**
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Via CLI flag
|
|
116
|
+
html-minifier-next --preset conservative input.html
|
|
117
|
+
|
|
118
|
+
# Via config file
|
|
119
|
+
html-minifier-next --config-file=html-minifier.json input.html
|
|
120
|
+
# where html-minifier.json contains: { "preset": "conservative" }
|
|
121
|
+
|
|
122
|
+
# Override preset options
|
|
123
|
+
html-minifier-next --preset conservative --remove-empty-attributes input.html
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Priority order:** Presets are applied first, then config file options, then CLI flags. This allows you to start with a preset and customize as needed.
|
|
127
|
+
|
|
128
128
|
## Options quick reference
|
|
129
129
|
|
|
130
130
|
Most of the options are disabled by default. Experiment and find what works best for you and your project.
|
package/dist/htmlminifier.cjs
CHANGED
|
@@ -39622,7 +39622,6 @@ const presets = {
|
|
|
39622
39622
|
collapseBooleanAttributes: true,
|
|
39623
39623
|
collapseInlineTagWhitespace: true,
|
|
39624
39624
|
collapseWhitespace: true,
|
|
39625
|
-
conservativeCollapse: true,
|
|
39626
39625
|
continueOnParseError: true,
|
|
39627
39626
|
decodeEntities: true,
|
|
39628
39627
|
minifyCSS: true,
|
package/dist/types/presets.d.ts
CHANGED
|
@@ -31,8 +31,6 @@ export namespace presets {
|
|
|
31
31
|
export let collapseInlineTagWhitespace: boolean;
|
|
32
32
|
let collapseWhitespace_1: boolean;
|
|
33
33
|
export { collapseWhitespace_1 as collapseWhitespace };
|
|
34
|
-
let conservativeCollapse_1: boolean;
|
|
35
|
-
export { conservativeCollapse_1 as conservativeCollapse };
|
|
36
34
|
let continueOnParseError_1: boolean;
|
|
37
35
|
export { continueOnParseError_1 as continueOnParseError };
|
|
38
36
|
let decodeEntities_1: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/presets.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/presets.js"],"names":[],"mappings":"AAgDA;;;;GAIG;AACH,gCAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAMvB;AAED;;;GAGG;AACH,kCAFa,MAAM,EAAE,CAIpB"}
|
package/package.json
CHANGED
package/src/presets.js
CHANGED
|
@@ -26,7 +26,6 @@ export const presets = {
|
|
|
26
26
|
collapseBooleanAttributes: true,
|
|
27
27
|
collapseInlineTagWhitespace: true,
|
|
28
28
|
collapseWhitespace: true,
|
|
29
|
-
conservativeCollapse: true,
|
|
30
29
|
continueOnParseError: true,
|
|
31
30
|
decodeEntities: true,
|
|
32
31
|
minifyCSS: true,
|
|
@@ -64,4 +63,4 @@ export function getPreset(name) {
|
|
|
64
63
|
*/
|
|
65
64
|
export function getPresetNames() {
|
|
66
65
|
return Object.keys(presets);
|
|
67
|
-
}
|
|
66
|
+
}
|