html-minifier-next 4.7.1 → 4.8.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.
- package/README.md +19 -19
- package/cli.js +4 -3
- package/dist/htmlminifier.cjs +1884 -1660
- package/dist/htmlminifier.esm.bundle.js +33820 -33531
- package/dist/types/htmlminifier.d.ts +29 -3
- package/dist/types/htmlminifier.d.ts.map +1 -1
- package/dist/types/htmlparser.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/htmlminifier.js +1877 -1662
- package/src/htmlparser.js +10 -1
|
@@ -46,7 +46,7 @@ export type MinifierOptions = {
|
|
|
46
46
|
caseSensitive?: boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Collapse boolean attributes to their name only (for example
|
|
49
|
-
* `disabled="disabled"`
|
|
49
|
+
* `disabled="disabled"` → `disabled`).
|
|
50
50
|
* See also: https://perfectionkills.com/experimenting-with-html-minifier/#collapse_boolean_attributes
|
|
51
51
|
*
|
|
52
52
|
* Default: `false`
|
|
@@ -326,6 +326,32 @@ export type MinifierOptions = {
|
|
|
326
326
|
* Default: `false`
|
|
327
327
|
*/
|
|
328
328
|
removeEmptyElements?: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Specifies empty elements to preserve when `removeEmptyElements` is enabled.
|
|
331
|
+
* Has no effect unless `removeEmptyElements: true`.
|
|
332
|
+
*
|
|
333
|
+
* Accepts tag names or HTML-like element specifications:
|
|
334
|
+
*
|
|
335
|
+
* * Tag name only: `["td", "span"]`—preserves all empty elements of these types
|
|
336
|
+
* * With valued attributes: `["<span aria-hidden='true'>"]`—preserves only when attribute values match
|
|
337
|
+
* * With boolean attributes: `["<input disabled>"]`—preserves only when boolean attribute is present
|
|
338
|
+
* * Mixed: `["<button type='button' disabled>"]`—all specified attributes must match
|
|
339
|
+
*
|
|
340
|
+
* Attribute matching:
|
|
341
|
+
*
|
|
342
|
+
* * All specified attributes must be present and match (valued attributes must have exact values)
|
|
343
|
+
* * Additional attributes on the element are allowed
|
|
344
|
+
* * Attribute name matching respects the `caseSensitive` option
|
|
345
|
+
* * Supports double quotes, single quotes, and unquoted attribute values in specifications
|
|
346
|
+
*
|
|
347
|
+
* Limitations:
|
|
348
|
+
*
|
|
349
|
+
* * Self-closing syntax (e.g., `["<span/>"]`) is not supported; use `["span"]` instead
|
|
350
|
+
* * Definitions containing `>` within quoted attribute values (e.g., `["<span title='a>b'>"]`) are not supported
|
|
351
|
+
*
|
|
352
|
+
* Default: `[]`
|
|
353
|
+
*/
|
|
354
|
+
removeEmptyElementsExcept?: string[];
|
|
329
355
|
/**
|
|
330
356
|
* Drop optional start/end tags where the HTML specification permits it
|
|
331
357
|
* (for example `</li>`, optional `<html>` etc.).
|
|
@@ -335,7 +361,7 @@ export type MinifierOptions = {
|
|
|
335
361
|
*/
|
|
336
362
|
removeOptionalTags?: boolean;
|
|
337
363
|
/**
|
|
338
|
-
* Remove attributes that are redundant because they match the element
|
|
364
|
+
* Remove attributes that are redundant because they match the element’s
|
|
339
365
|
* default values (for example `<button type="submit">`).
|
|
340
366
|
* See also: https://perfectionkills.com/experimenting-with-html-minifier/#remove_redundant_attributes
|
|
341
367
|
*
|
|
@@ -357,7 +383,7 @@ export type MinifierOptions = {
|
|
|
357
383
|
*/
|
|
358
384
|
removeStyleLinkTypeAttributes?: boolean;
|
|
359
385
|
/**
|
|
360
|
-
* **Note that this will
|
|
386
|
+
* **Note that this will result in invalid HTML!**
|
|
361
387
|
*
|
|
362
388
|
* When true, extra whitespace between tag name and attributes (or before
|
|
363
389
|
* the closing bracket) will be removed where possible. Affects output spacing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"htmlminifier.d.ts","sourceRoot":"","sources":["../../src/htmlminifier.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"htmlminifier.d.ts","sourceRoot":"","sources":["../../src/htmlminifier.js"],"names":[],"mappings":"AAoqEO,8BAJI,MAAM,YACN,eAAe,GACb,OAAO,CAA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|
|
1
|
+
{"version":3,"file":"htmlparser.d.ts","sourceRoot":"","sources":["../../src/htmlparser.js"],"names":[],"mappings":"AAgDA,4BAAoE;AAoEpE;IACE,qCAGC;IAFC,UAAgB;IAChB,aAAsB;IAGxB,uBA8bC;CACF"}
|
package/package.json
CHANGED