htmlnano 2.1.2 → 2.1.3

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 (186) hide show
  1. package/README.md +53 -12
  2. package/dist/_modules/collapseAttributeWhitespace.d.mts +57 -0
  3. package/dist/_modules/collapseAttributeWhitespace.d.ts +57 -0
  4. package/dist/_modules/collapseAttributeWhitespace.js +296 -0
  5. package/dist/_modules/collapseAttributeWhitespace.mjs +293 -0
  6. package/dist/_modules/collapseBooleanAttributes.d.mts +60 -0
  7. package/dist/_modules/collapseBooleanAttributes.d.ts +60 -0
  8. package/dist/_modules/collapseBooleanAttributes.js +159 -0
  9. package/{lib/modules → dist/_modules}/collapseBooleanAttributes.mjs +39 -57
  10. package/dist/_modules/collapseWhitespace.d.mts +57 -0
  11. package/dist/_modules/collapseWhitespace.d.ts +57 -0
  12. package/dist/_modules/collapseWhitespace.js +172 -0
  13. package/dist/_modules/collapseWhitespace.mjs +170 -0
  14. package/dist/_modules/custom.d.mts +57 -0
  15. package/dist/_modules/custom.d.ts +57 -0
  16. package/dist/_modules/custom.js +22 -0
  17. package/dist/_modules/custom.mjs +20 -0
  18. package/dist/_modules/deduplicateAttributeValues.d.mts +56 -0
  19. package/dist/_modules/deduplicateAttributeValues.d.ts +56 -0
  20. package/dist/_modules/deduplicateAttributeValues.js +38 -0
  21. package/dist/_modules/deduplicateAttributeValues.mjs +36 -0
  22. package/dist/_modules/example.d.mts +59 -0
  23. package/dist/_modules/example.d.ts +59 -0
  24. package/dist/_modules/example.js +67 -0
  25. package/dist/_modules/example.mjs +65 -0
  26. package/dist/_modules/mergeScripts.d.mts +56 -0
  27. package/dist/_modules/mergeScripts.d.ts +56 -0
  28. package/dist/_modules/mergeScripts.js +53 -0
  29. package/dist/_modules/mergeScripts.mjs +51 -0
  30. package/dist/_modules/mergeStyles.d.mts +56 -0
  31. package/dist/_modules/mergeStyles.d.ts +56 -0
  32. package/dist/_modules/mergeStyles.js +42 -0
  33. package/dist/_modules/mergeStyles.mjs +40 -0
  34. package/dist/_modules/minifyConditionalComments.d.mts +56 -0
  35. package/dist/_modules/minifyConditionalComments.d.ts +56 -0
  36. package/dist/_modules/minifyConditionalComments.js +54 -0
  37. package/{lib/modules → dist/_modules}/minifyConditionalComments.mjs +21 -22
  38. package/dist/_modules/minifyCss.d.mts +56 -0
  39. package/dist/_modules/minifyCss.d.ts +56 -0
  40. package/dist/_modules/minifyCss.js +84 -0
  41. package/dist/_modules/minifyCss.mjs +82 -0
  42. package/dist/_modules/minifyJs.d.mts +56 -0
  43. package/dist/_modules/minifyJs.d.ts +56 -0
  44. package/dist/_modules/minifyJs.js +108 -0
  45. package/dist/_modules/minifyJs.mjs +106 -0
  46. package/dist/_modules/minifyJson.d.mts +56 -0
  47. package/dist/_modules/minifyJson.d.ts +56 -0
  48. package/dist/_modules/minifyJson.js +35 -0
  49. package/dist/_modules/minifyJson.mjs +33 -0
  50. package/dist/_modules/minifySvg.d.mts +56 -0
  51. package/dist/_modules/minifySvg.d.ts +56 -0
  52. package/dist/_modules/minifySvg.js +40 -0
  53. package/dist/_modules/minifySvg.mjs +38 -0
  54. package/dist/_modules/minifyUrls.d.mts +56 -0
  55. package/dist/_modules/minifyUrls.d.ts +56 -0
  56. package/dist/_modules/minifyUrls.js +180 -0
  57. package/dist/_modules/minifyUrls.mjs +178 -0
  58. package/dist/_modules/normalizeAttributeValues.d.mts +56 -0
  59. package/dist/_modules/normalizeAttributeValues.d.ts +56 -0
  60. package/dist/_modules/normalizeAttributeValues.js +234 -0
  61. package/dist/_modules/normalizeAttributeValues.mjs +232 -0
  62. package/dist/_modules/removeAttributeQuotes.d.mts +56 -0
  63. package/dist/_modules/removeAttributeQuotes.d.ts +56 -0
  64. package/dist/_modules/removeAttributeQuotes.js +15 -0
  65. package/dist/_modules/removeAttributeQuotes.mjs +13 -0
  66. package/dist/_modules/removeComments.d.mts +58 -0
  67. package/dist/_modules/removeComments.d.ts +58 -0
  68. package/dist/_modules/removeComments.js +83 -0
  69. package/{lib/modules → dist/_modules}/removeComments.mjs +24 -35
  70. package/dist/_modules/removeEmptyAttributes.d.mts +56 -0
  71. package/dist/_modules/removeEmptyAttributes.d.ts +56 -0
  72. package/dist/_modules/removeEmptyAttributes.js +197 -0
  73. package/dist/_modules/removeEmptyAttributes.mjs +195 -0
  74. package/dist/_modules/removeOptionalTags.d.mts +56 -0
  75. package/dist/_modules/removeOptionalTags.d.ts +56 -0
  76. package/dist/_modules/removeOptionalTags.js +190 -0
  77. package/{lib/modules → dist/_modules}/removeOptionalTags.mjs +54 -91
  78. package/dist/_modules/removeRedundantAttributes.d.mts +57 -0
  79. package/dist/_modules/removeRedundantAttributes.d.ts +57 -0
  80. package/dist/_modules/removeRedundantAttributes.js +128 -0
  81. package/{lib/modules → dist/_modules}/removeRedundantAttributes.mjs +43 -59
  82. package/dist/_modules/removeUnusedCss.d.mts +60 -0
  83. package/dist/_modules/removeUnusedCss.d.ts +60 -0
  84. package/dist/_modules/removeUnusedCss.js +134 -0
  85. package/dist/_modules/removeUnusedCss.mjs +132 -0
  86. package/dist/_modules/sortAttributes.d.mts +57 -0
  87. package/dist/_modules/sortAttributes.d.ts +57 -0
  88. package/dist/_modules/sortAttributes.js +102 -0
  89. package/{lib/modules → dist/_modules}/sortAttributes.mjs +39 -58
  90. package/dist/_modules/sortAttributesWithLists.d.mts +56 -0
  91. package/dist/_modules/sortAttributesWithLists.d.ts +56 -0
  92. package/dist/_modules/sortAttributesWithLists.js +118 -0
  93. package/{lib/modules → dist/_modules}/sortAttributesWithLists.mjs +41 -59
  94. package/dist/helpers.js +72 -0
  95. package/dist/helpers.mjs +63 -0
  96. package/dist/index.js +223 -0
  97. package/dist/index.mjs +209 -0
  98. package/dist/presets/ampSafe.js +19 -0
  99. package/{lib → dist}/presets/ampSafe.mjs +6 -4
  100. package/dist/presets/max.js +28 -0
  101. package/{lib → dist}/presets/max.mjs +6 -4
  102. package/dist/presets/safe.js +60 -0
  103. package/{lib → dist}/presets/safe.mjs +13 -20
  104. package/package.json +48 -56
  105. package/.eslintignore +0 -3
  106. package/CHANGELOG.md +0 -409
  107. package/docs/README.md +0 -33
  108. package/docs/babel.config.js +0 -3
  109. package/docs/docs/010-introduction.md +0 -22
  110. package/docs/docs/020-usage.md +0 -117
  111. package/docs/docs/030-config.md +0 -21
  112. package/docs/docs/040-presets.md +0 -75
  113. package/docs/docs/050-modules.md +0 -855
  114. package/docs/docs/060-contribute.md +0 -16
  115. package/docs/docusaurus.config.js +0 -65
  116. package/docs/netlify.toml +0 -4
  117. package/docs/package-lock.json +0 -21630
  118. package/docs/package.json +0 -40
  119. package/docs/sidebars.js +0 -26
  120. package/docs/versioned_docs/version-1.1.1/010-introduction.md +0 -22
  121. package/docs/versioned_docs/version-1.1.1/020-usage.md +0 -77
  122. package/docs/versioned_docs/version-1.1.1/030-config.md +0 -21
  123. package/docs/versioned_docs/version-1.1.1/040-presets.md +0 -75
  124. package/docs/versioned_docs/version-1.1.1/050-modules.md +0 -785
  125. package/docs/versioned_docs/version-1.1.1/060-contribute.md +0 -16
  126. package/docs/versioned_docs/version-2.0.0/010-introduction.md +0 -22
  127. package/docs/versioned_docs/version-2.0.0/020-usage.md +0 -77
  128. package/docs/versioned_docs/version-2.0.0/030-config.md +0 -21
  129. package/docs/versioned_docs/version-2.0.0/040-presets.md +0 -75
  130. package/docs/versioned_docs/version-2.0.0/050-modules.md +0 -838
  131. package/docs/versioned_docs/version-2.0.0/060-contribute.md +0 -16
  132. package/docs/versioned_sidebars/version-1.1.1-sidebars.json +0 -8
  133. package/docs/versioned_sidebars/version-2.0.0-sidebars.json +0 -8
  134. package/docs/versions.json +0 -4
  135. package/index.cjs +0 -11
  136. package/index.d.cts +0 -3
  137. package/index.d.mts +0 -3
  138. package/index.d.ts +0 -94
  139. package/index.mjs +0 -2
  140. package/lib/helpers.cjs +0 -79
  141. package/lib/helpers.mjs +0 -53
  142. package/lib/htmlnano.cjs +0 -202
  143. package/lib/htmlnano.mjs +0 -198
  144. package/lib/modules/collapseAttributeWhitespace.cjs +0 -86
  145. package/lib/modules/collapseAttributeWhitespace.mjs +0 -104
  146. package/lib/modules/collapseBooleanAttributes.cjs +0 -62
  147. package/lib/modules/collapseWhitespace.cjs +0 -100
  148. package/lib/modules/collapseWhitespace.mjs +0 -132
  149. package/lib/modules/custom.cjs +0 -19
  150. package/lib/modules/custom.mjs +0 -16
  151. package/lib/modules/deduplicateAttributeValues.cjs +0 -38
  152. package/lib/modules/deduplicateAttributeValues.mjs +0 -40
  153. package/lib/modules/example.cjs +0 -85
  154. package/lib/modules/example.mjs +0 -75
  155. package/lib/modules/mergeScripts.cjs +0 -54
  156. package/lib/modules/mergeScripts.mjs +0 -56
  157. package/lib/modules/mergeStyles.cjs +0 -38
  158. package/lib/modules/mergeStyles.mjs +0 -36
  159. package/lib/modules/minifyConditionalComments.cjs +0 -47
  160. package/lib/modules/minifyCss.cjs +0 -73
  161. package/lib/modules/minifyCss.mjs +0 -88
  162. package/lib/modules/minifyJs.cjs +0 -103
  163. package/lib/modules/minifyJs.mjs +0 -121
  164. package/lib/modules/minifyJson.cjs +0 -24
  165. package/lib/modules/minifyJson.mjs +0 -21
  166. package/lib/modules/minifySvg.cjs +0 -37
  167. package/lib/modules/minifySvg.mjs +0 -30
  168. package/lib/modules/minifyUrls.cjs +0 -141
  169. package/lib/modules/minifyUrls.mjs +0 -229
  170. package/lib/modules/normalizeAttributeValues.cjs +0 -120
  171. package/lib/modules/normalizeAttributeValues.mjs +0 -140
  172. package/lib/modules/removeAttributeQuotes.cjs +0 -17
  173. package/lib/modules/removeAttributeQuotes.mjs +0 -12
  174. package/lib/modules/removeComments.cjs +0 -86
  175. package/lib/modules/removeEmptyAttributes.cjs +0 -72
  176. package/lib/modules/removeEmptyAttributes.mjs +0 -121
  177. package/lib/modules/removeOptionalTags.cjs +0 -183
  178. package/lib/modules/removeRedundantAttributes.cjs +0 -112
  179. package/lib/modules/removeUnusedCss.cjs +0 -113
  180. package/lib/modules/removeUnusedCss.mjs +0 -122
  181. package/lib/modules/sortAttributes.cjs +0 -98
  182. package/lib/modules/sortAttributesWithLists.cjs +0 -114
  183. package/lib/presets/ampSafe.cjs +0 -18
  184. package/lib/presets/max.cjs +0 -27
  185. package/lib/presets/safe.cjs +0 -65
  186. package/test.js +0 -23
@@ -0,0 +1,60 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+
3
+ /**
4
+ * Minify HTML in a safe way without breaking anything.
5
+ */ var safe = {
6
+ /* ----------------------------------------
7
+ * Attributes
8
+ * ---------------------------------------- */ // normalize the case of attribute names and values
9
+ // normalizeAttributeValues will also normalize property value with invalid value default
10
+ // See https://html.spec.whatwg.org/#invalid-value-default
11
+ normalizeAttributeValues: true,
12
+ removeEmptyAttributes: true,
13
+ collapseAttributeWhitespace: true,
14
+ // removeRedundantAttributes will remove attributes when missing value default matches the attribute's value
15
+ // See https://html.spec.whatwg.org/#missing-value-default
16
+ removeRedundantAttributes: false,
17
+ // collapseBooleanAttributes will also collapse those default state can be omitted
18
+ collapseBooleanAttributes: {
19
+ amphtml: false
20
+ },
21
+ deduplicateAttributeValues: true,
22
+ minifyUrls: false,
23
+ sortAttributes: false,
24
+ sortAttributesWithLists: 'alphabetical',
25
+ /* ----------------------------------------
26
+ * Minify HTML content
27
+ * ---------------------------------------- */ collapseWhitespace: 'conservative',
28
+ removeComments: 'safe',
29
+ minifyConditionalComments: false,
30
+ removeOptionalTags: false,
31
+ removeAttributeQuotes: false,
32
+ /* ----------------------------------------
33
+ * Minify inline <style>, <script> and <svg> tag
34
+ * ---------------------------------------- */ mergeStyles: false,
35
+ mergeScripts: false,
36
+ minifyCss: {
37
+ preset: 'default'
38
+ },
39
+ minifyJs: {},
40
+ minifyJson: {},
41
+ minifySvg: {
42
+ plugins: [
43
+ {
44
+ name: 'preset-default',
45
+ params: {
46
+ overrides: {
47
+ collapseGroups: false,
48
+ convertShapeToPath: false
49
+ }
50
+ }
51
+ }
52
+ ]
53
+ },
54
+ removeUnusedCss: false,
55
+ /* ----------------------------------------
56
+ * Miscellaneous
57
+ * ---------------------------------------- */ custom: (tree, _options)=>tree
58
+ };
59
+
60
+ exports.default = safe;
@@ -1,11 +1,9 @@
1
1
  /**
2
2
  * Minify HTML in a safe way without breaking anything.
3
- */
4
- export default {
3
+ */ var safe = {
5
4
  /* ----------------------------------------
6
5
  * Attributes
7
- * ---------------------------------------- */
8
- // normalize the case of attribute names and values
6
+ * ---------------------------------------- */ // normalize the case of attribute names and values
9
7
  // normalizeAttributeValues will also normalize property value with invalid value default
10
8
  // See https://html.spec.whatwg.org/#invalid-value-default
11
9
  normalizeAttributeValues: true,
@@ -16,30 +14,25 @@ export default {
16
14
  removeRedundantAttributes: false,
17
15
  // collapseBooleanAttributes will also collapse those default state can be omitted
18
16
  collapseBooleanAttributes: {
19
- amphtml: false,
17
+ amphtml: false
20
18
  },
21
19
  deduplicateAttributeValues: true,
22
-
23
20
  minifyUrls: false,
24
-
25
21
  sortAttributes: false,
26
22
  sortAttributesWithLists: 'alphabetical',
27
-
28
23
  /* ----------------------------------------
29
24
  * Minify HTML content
30
- * ---------------------------------------- */
31
- collapseWhitespace: 'conservative',
25
+ * ---------------------------------------- */ collapseWhitespace: 'conservative',
32
26
  removeComments: 'safe',
33
27
  minifyConditionalComments: false,
34
28
  removeOptionalTags: false,
35
29
  removeAttributeQuotes: false,
36
30
  /* ----------------------------------------
37
31
  * Minify inline <style>, <script> and <svg> tag
38
- * ---------------------------------------- */
39
- mergeStyles: false,
32
+ * ---------------------------------------- */ mergeStyles: false,
40
33
  mergeScripts: false,
41
34
  minifyCss: {
42
- preset: 'default',
35
+ preset: 'default'
43
36
  },
44
37
  minifyJs: {},
45
38
  minifyJson: {},
@@ -50,16 +43,16 @@ export default {
50
43
  params: {
51
44
  overrides: {
52
45
  collapseGroups: false,
53
- convertShapeToPath: false,
54
- },
55
- },
56
- },
46
+ convertShapeToPath: false
47
+ }
48
+ }
49
+ }
57
50
  ]
58
51
  },
59
52
  removeUnusedCss: false,
60
-
61
53
  /* ----------------------------------------
62
54
  * Miscellaneous
63
- * ---------------------------------------- */
64
- custom: []
55
+ * ---------------------------------------- */ custom: (tree, _options)=>tree
65
56
  };
57
+
58
+ export { safe as default };
package/package.json CHANGED
@@ -1,37 +1,46 @@
1
1
  {
2
2
  "name": "htmlnano",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Modular HTML minifier, built on top of the PostHTML",
5
- "main": "index.cjs",
6
- "module": "index.mjs",
7
- "source": "index.mjs",
8
- "exports": {
9
- ".": {
10
- "types": "./index.d.ts",
11
- "require": "./index.cjs",
12
- "import": "./index.mjs"
13
- },
14
- "./index.mjs": {
15
- "types": "./index.d.mts",
16
- "import": "./index.mjs"
17
- },
18
- "./index.cjs": {
19
- "types": "./index.d.cts",
20
- "require": "./index.cjs"
21
- }
22
- },
23
- "types": "index.d.ts",
24
5
  "author": "Kirill Maltsev <maltsevkirill@gmail.com>",
25
6
  "license": "MIT",
26
7
  "scripts": {
27
- "clean": "rimraf lib/*.cjs lib/**/*.cjs",
28
- "compile": "npm run clean && babel -d lib/ lib/ --out-file-extension .cjs",
29
- "lint": "eslint --fix *.mjs lib/*.mjs lib/**/*.mjs test/*.mjs test/**/*.mjs",
8
+ "clean": "rimraf dist",
9
+ "build": "npm run clean && bunchee",
10
+ "compile": "npm run build",
11
+ "lint": "eslint --fix .",
30
12
  "pretest": "npm run lint && npm run compile",
31
13
  "test": ":",
32
- "posttest": "mocha --timeout 5000 --require @babel/register --recursive --check-leaks --globals addresses",
14
+ "posttest": "mocha --timeout 5000 --require @swc-node/register --recursive --check-leaks --globals addresses",
33
15
  "prepare": "npm run compile"
34
16
  },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "main": "./dist/index.js",
21
+ "module": "./dist/index.mjs",
22
+ "exports": {
23
+ "./helpers": {
24
+ "import": "./dist/helpers.mjs",
25
+ "require": "./dist/helpers.js"
26
+ },
27
+ ".": {
28
+ "import": "./dist/index.mjs",
29
+ "require": "./dist/index.js"
30
+ },
31
+ "./presets/ampSafe": {
32
+ "import": "./dist/presets/ampSafe.mjs",
33
+ "require": "./dist/presets/ampSafe.js"
34
+ },
35
+ "./presets/max": {
36
+ "import": "./dist/presets/max.mjs",
37
+ "require": "./dist/presets/max.js"
38
+ },
39
+ "./presets/safe": {
40
+ "import": "./dist/presets/safe.mjs",
41
+ "require": "./dist/presets/safe.js"
42
+ }
43
+ },
35
44
  "keywords": [
36
45
  "posthtml",
37
46
  "posthtml-plugin",
@@ -39,44 +48,24 @@
39
48
  "postproccessor",
40
49
  "minifier"
41
50
  ],
42
- "babel": {
43
- "presets": [
44
- [
45
- "@babel/env",
46
- {
47
- "targets": {
48
- "node": 10
49
- }
50
- }
51
- ]
52
- ],
53
- "plugins": [
54
- [
55
- "@aminya/babel-plugin-replace-import-extension",
56
- {
57
- "extMapping": {
58
- ".mjs": ".cjs"
59
- }
60
- }
61
- ]
62
- ]
63
- },
64
51
  "dependencies": {
52
+ "@types/relateurl": "^0.2.33",
65
53
  "cosmiconfig": "^9.0.0",
66
54
  "posthtml": "^0.16.5"
67
55
  },
68
56
  "devDependencies": {
69
- "@aminya/babel-plugin-replace-import-extension": "1.2.0",
70
- "@babel/cli": "^7.15.7",
71
- "@babel/core": "^7.15.5",
72
- "@babel/eslint-parser": "^7.17.0",
73
- "@babel/preset-env": "^7.15.6",
74
- "@babel/register": "^7.15.3",
57
+ "@stylistic/eslint-plugin": "^5.3.1",
58
+ "@swc-node/register": "^1.10.10",
59
+ "@types/node": "^24.0.0",
60
+ "bunchee": "^6.5.1",
75
61
  "cssnano": "^7.0.0",
76
- "eslint": "^8.12.0",
62
+ "eslint": "^9.25.1",
63
+ "eslint-config-flat-gitignore": "^2.1.0",
77
64
  "eslint-plugin-import": "^2.28.1",
78
- "eslint-plugin-path-import-extension": "^0.9.0",
79
- "expect": "^29.0.0",
65
+ "eslint-plugin-import-x": "^4.11.0",
66
+ "eslint-plugin-unused-imports": "^4.1.4",
67
+ "expect": "^30.1.1",
68
+ "globals": "^16.0.0",
80
69
  "mocha": "^11.0.1",
81
70
  "postcss": "^8.3.11",
82
71
  "purgecss": "^7.0.2",
@@ -85,6 +74,8 @@
85
74
  "srcset": "5.0.1",
86
75
  "svgo": "^3.0.2",
87
76
  "terser": "^5.21.0",
77
+ "typescript": "^5.8.3",
78
+ "typescript-eslint": "^8.31.1",
88
79
  "uncss": "^0.17.3"
89
80
  },
90
81
  "peerDependencies": {
@@ -130,5 +121,6 @@
130
121
  "bugs": {
131
122
  "url": "https://github.com/posthtml/htmlnano/issues"
132
123
  },
133
- "homepage": "https://github.com/posthtml/htmlnano"
124
+ "homepage": "https://github.com/posthtml/htmlnano",
125
+ "packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
134
126
  }
package/.eslintignore DELETED
@@ -1,3 +0,0 @@
1
- lib/modules/example.mjs
2
- test.mjs
3
- **/*.cjs
package/CHANGELOG.md DELETED
@@ -1,409 +0,0 @@
1
- # Change Log
2
- All notable changes to this project will be documented in this file.
3
- This project adheres to [Semantic Versioning](http://semver.org/).
4
-
5
- ## [2.1.2] - 2025-04-30
6
-
7
- ### Added
8
- - `skipInternalWarnings` flag to avoid `console.warn` output [#293]
9
-
10
- ### Fixed
11
- - Use Node.js `sort` instead of `timsort` [#328]
12
-
13
-
14
- ## [2.1.1] - 2024-04-28
15
-
16
- ### Fixed
17
- - Downlevel-revealed closing comment being deleted in safe mode [#278]
18
-
19
-
20
- ## [2.1.0] - 2023-10-19
21
-
22
- ### Added
23
- - Convert htmlnano to ES Modules [#260]
24
-
25
- ### Fixed
26
- - Collapse white spaces according to specs [#257]
27
-
28
-
29
- ## [2.0.4] - 2023-04-15
30
-
31
- ### Fixed
32
- - Should not minify `<script>` and `<style>` with SRI [#220]
33
- - Should not merge `<style>` or `<script>` with SRI [#220]
34
- - Should not minify json with SRI [#220]
35
-
36
-
37
- ## [2.0.3] - 2022-11-13
38
-
39
- ### Added
40
- - Minify function for `HtmlMinimizerWebpackPlugin`
41
-
42
- ### Fixed
43
- - `collapseWhitespace`: handle textNode when comment is preserved [#184]
44
- - `minifyUrls`: srcset & javascript: url [#185]
45
- - Correct missing value default usage
46
- - `collapseBooleanAttributes`: empty string attributes
47
- - Guard type of attributes' value [#195]
48
- - Do not choke on svg error [#197]
49
-
50
- ### Changed
51
- - Minify based on invalid value default
52
- - Avoid hardcoding preset keys
53
-
54
-
55
- ## [2.0.2] - 2022-04-06
56
-
57
- ### Fixed
58
- - JSON-LD crash [#182]
59
-
60
-
61
- ## [2.0.1] - 2022-04-04
62
- **This version contains a critical bug [#182].**
63
- **Don't use it.**
64
-
65
- ### Changed
66
- - Speed improvements [#127]
67
- - Fix `<img sizes>` [#180]
68
-
69
-
70
- ## [2.0.0] - 2022-01-12
71
- *The major version has to be released because of vulnerability in PostCSS (see [#165])*
72
-
73
- ### Changed
74
- - Support optional dependencies [#168] (`minifyUrl`, ` minifyJs`, `removeUnusedCss`, `minifyCss`). *This might be a breaking change for you*. Check the docs: https://github.com/posthtml/htmlnano/pull/168/files
75
- - Disable `mergeScripts` & `mergeStyles` in the safe preset [#170].
76
-
77
-
78
- ## [1.1.1] - 2021-09-19
79
- This version fixes fatal errors introduced in [1.1.0].
80
-
81
-
82
- ## [1.1.0] - 2021-09-19
83
- *This version contains fatal errors. Please use [1.1.1] instead.*
84
-
85
- ### Added
86
- - Collapse missing value default attribute in `removeRedundantAttributes` [#158].
87
- - New `normalizeAttributeValues` module to normalize casing of attribute values [#163].
88
- - Custom matcher for `removeComments` [#156].
89
-
90
- ### Changed
91
- - Remove more empty attributes in `removeEmptyAttributes` [#161].
92
- - Enhance collapse whitespace in `collapseWhitespace` [#145].
93
- - `minifyJs` and `minifyUrls` enhancement [#159].
94
- - Enhance attribute collapse whitespace in `collapseAttributeWhitespace` [#157].
95
-
96
-
97
-
98
- ## [1.0.1] - 2021-09-11
99
- ### Added
100
- - Support of [@novaatwarren/uncss](https://github.com/novaatwarren/uncss) fork [#154]
101
-
102
- ### Changed
103
- - SVGO plugins configuration [#153]
104
-
105
-
106
-
107
- ## [1.0.0] - 2021-04-17
108
- After more than 4 years of development, it's time to release a stable [1.0.0](https://github.com/posthtml/htmlnano/releases/tag/1.0.0) version 🎉
109
-
110
- It doesn't contain anything new from the previous [0.2.9](https://github.com/posthtml/htmlnano/releases/tag/0.2.9) release.
111
- We just did a major upgrade of two dependencies: [PurgeCSS](https://purgecss.com/) and [SVGO](https://github.com/svg/svgo),
112
- which changed their config format.
113
- Thus we have to do a major release of `htmlnano`.
114
-
115
- You can safely upgrade to `htmlnano@1.0.0` if you don't pass any config to `minifySvg` or `removeUnusedCss` (while used with PurgeCSS) modules.
116
- Otherwise, you have to adapt the config according to the new [PurgeCSS@3](https://github.com/FullHuman/purgecss/releases/tag/v3.0.0) and [SVGO@2](https://github.com/svg/svgo/releases/tag/v2.0.0) config format.
117
-
118
-
119
-
120
- ## [0.2.9] - 2021-04-11
121
- ### Added
122
- - `minifyConditionalComment` support `<html>` [#125].
123
- - Minify JS within `<script type="module">` [#135].
124
-
125
- ### Fixed
126
- - `collapseWhitespaces` around comment [#120].
127
- - handle `CDATA` inside script correctly [#122].
128
- - Minify SVG correctly [#129].
129
-
130
- ### Changed
131
- - Upgrade to terser@5 (JS minification).
132
-
133
-
134
-
135
- ## [0.2.8] - 2020-11-15
136
- ### Added
137
- - [`removeOptionalTags`](https://github.com/posthtml/htmlnano#removeoptionaltags) [#110].
138
- - [`sortAttributes`](https://github.com/posthtml/htmlnano#removeoptionaltags) [#113].
139
- - `source[src]` and `srcset` support to `minifyUrls` [#117].
140
- - [`minifyConditionalComments`](https://github.com/posthtml/htmlnano#minifyconditionalcomments) [#119].
141
-
142
- ### Changed
143
- - Sort by frequency `sortAttributesWithLists` [#111].
144
- - Strip more spaces in `collapseWhitespace` [#112].
145
- - Remove `loading="eager"` from `<img>` and `<iframe>` [#114].
146
- - Remove redundant `type` from `<script>` [#114].
147
- - Strip whitespaces between textnode and element [#116].
148
-
149
-
150
-
151
- ## [0.2.7] - 2020-10-17
152
- ### Added
153
- - More aggressive whitespace removal option [#90].
154
- - Cloudflare SSE support to `removeComments` [#94].
155
- - Improve compression ratio by sorting attribute values [#95].
156
- - New `minifyUrls` module [#98].
157
- - New `removeAttributeQuotes` module [#104].
158
- - Remove `type=text/css` for `link[rel=stylesheet]` [#102].
159
- - Collapse `crossorigin` attributes [#107].
160
- - Exclude excerpt comment for common CMS [#108].
161
-
162
- ### Fixed
163
- - Keep JS inside SVG wrapped in `//<![CDATA[ //]]` [#88].
164
-
165
-
166
- ## [0.2.6] - 2020-07-15
167
- ### Added
168
- - Let PostHTML options to be passed.
169
-
170
- ### Fixed
171
- - `<script>` tags merging without content.
172
-
173
-
174
- ## [0.2.5] - 2019-11-09
175
- ### Added
176
- - Option to remove unused CSS using PurgeCSS [#84].
177
-
178
- ### Fixed
179
- - Keep the order of inline and external JS [#80].
180
-
181
-
182
- ## [0.2.4] - 2019-07-11
183
- ### Fixed
184
- - Remove crossorigin from boolean attribute [#78], [#79].
185
- - Disable SVGO plugin convertShapeToPath in safe preset [#76].
186
-
187
-
188
- ## [0.2.3] - 2019-02-14
189
- ### Fixed
190
- - Keep `<g>` in SVG by default [#71].
191
-
192
-
193
- ## [0.2.2] - 2019-01-03
194
- ### Added
195
- - `removeUnusedCss` module [#36].
196
-
197
- ### Fixed
198
- - Bug when `tag === false` [#66].
199
- - Add `crossorigin` to boolean attributes [#67].
200
-
201
-
202
- ## [0.2.1] - 2018-12-01
203
- ### Fixed
204
- - Disable JS minifying on AMP pages [#65].
205
-
206
- ## [0.2.0] - 2018-09-14
207
- ### Breaking changes
208
- - The API of `minifyCss` module has been changed since `cssnano` has been updated to version 4, which has a different API. Check the following resources for more info:
209
- * [htmlnano docs](https://github.com/posthtml/htmlnano#minifycss)
210
- * [cssnano docs](https://cssnano.co/guides/presets)
211
- * Diff of commit [979f2c](https://github.com/posthtml/htmlnano/commit/979f2c821892c9e979e8b85f74ed0394330fceaf) with the changes of related docs.
212
-
213
- ### Added
214
- - Add presets [#64].
215
- - Add `collapseAttributeWhitespace` module for collapsing spaces in list-like attributes [#25].
216
- - Add `deduplicateAttributeValues` module for de-duplicating values in list-like attributes [#39].
217
- - Better support for AMP pages [#59].
218
- - Collapse whitespaces between top-level tags [#24].
219
-
220
- ### Changed
221
- - Improve whitespace normalization using `normalize-html-whitespace` [#21].
222
-
223
- ### Fixed
224
- - Don't collapse `visible="false"` attributes in A-Frame pages [#62].
225
-
226
-
227
-
228
- ## [0.1.10] - 2018-08-03
229
- ### Fixed
230
- - Merging `<script>` tags without leading `;` [#55].
231
-
232
-
233
- ## [0.1.9] - 2018-04-29
234
- ### Fixed
235
- - Default minification options safety [#50].
236
-
237
-
238
- ## [0.1.8] - 2018-04-17
239
- ### Fixed
240
- - ES6+ minification [#48].
241
-
242
-
243
-
244
- ## [0.1.7] - 2018-03-13
245
- ### Fixed
246
- - Update dependencies which also fixes the SVG minification bug [#47].
247
-
248
-
249
-
250
- ## [0.1.6] - 2017-06-27
251
- ### Fixed
252
- - "Not a function" error [#42].
253
-
254
-
255
-
256
- ## [0.1.5] - 2016-04-24
257
- ### Added
258
- - Minify SVG [#28].
259
- - Merge `<script>` [#19].
260
-
261
- ### Changed
262
- - Remove redundant `type="submit"` from `<button>` [#31].
263
-
264
- ### Fixed
265
- - Windows build [#30].
266
-
267
-
268
- ## [0.1.4] - 2016-02-16
269
- ### Added
270
- - Minify JSON.
271
- - Merge multiple `<style>` into one.
272
- - Collapse boolean attributes.
273
- - Remove redundant attributes.
274
- - HTML minifiers benchmark [#22].
275
-
276
- ### Changed
277
- - Expand list of JSON-like mime types [#20].
278
-
279
-
280
- ## [0.1.3] - 2016-02-09
281
- ### Fixed
282
- - Don't alter HTML comments inside not relevant modules [#17].
283
-
284
-
285
- ## [0.1.2] - 2016-02-07
286
- ### Fixed
287
- - Don't remove conditional comments in safe mode [#13].
288
- - Downgrade: `String.startsWith -> String.search`.
289
-
290
-
291
- ## [0.1.1] - 2016-01-31
292
- ### Added
293
- - Minify CSS inside `<style>` tags and `style` attributes.
294
- - Minify JS inside `<script>` tags and `on*` attributes.
295
-
296
- ### Changed
297
- - Remove attributes that contains only white spaces.
298
-
299
-
300
- [2.1.2]: https://github.com/posthtml/htmlnano/compare/2.1.1...2.1.2
301
- [2.1.1]: https://github.com/posthtml/htmlnano/compare/2.1.0...2.1.1
302
- [2.1.0]: https://github.com/posthtml/htmlnano/compare/2.0.4...2.1.0
303
- [2.0.4]: https://github.com/posthtml/htmlnano/compare/2.0.3...2.0.4
304
- [2.0.3]: https://github.com/posthtml/htmlnano/compare/2.0.2...2.0.3
305
- [2.0.2]: https://github.com/posthtml/htmlnano/compare/2.0.1...2.0.2
306
- [2.0.1]: https://github.com/posthtml/htmlnano/compare/2.0.0...2.0.1
307
- [2.0.0]: https://github.com/posthtml/htmlnano/compare/1.1.1...2.0.0
308
- [1.1.1]: https://github.com/posthtml/htmlnano/compare/1.1.0...1.1.1
309
- [1.1.0]: https://github.com/posthtml/htmlnano/compare/1.0.1...1.1.0
310
- [1.0.1]: https://github.com/posthtml/htmlnano/compare/1.0.0...1.0.1
311
- [1.0.0]: https://github.com/posthtml/htmlnano/compare/0.2.9...1.0.0
312
- [0.2.9]: https://github.com/posthtml/htmlnano/compare/0.2.8...0.2.9
313
- [0.2.8]: https://github.com/posthtml/htmlnano/compare/0.2.7...0.2.8
314
- [0.2.7]: https://github.com/posthtml/htmlnano/compare/0.2.6...0.2.7
315
- [0.2.6]: https://github.com/posthtml/htmlnano/compare/0.2.5...0.2.6
316
- [0.2.5]: https://github.com/posthtml/htmlnano/compare/0.2.4...0.2.5
317
- [0.2.4]: https://github.com/posthtml/htmlnano/compare/0.2.3...0.2.4
318
- [0.2.3]: https://github.com/posthtml/htmlnano/compare/0.2.2...0.2.3
319
- [0.2.2]: https://github.com/posthtml/htmlnano/compare/0.2.1...0.2.2
320
- [0.2.1]: https://github.com/posthtml/htmlnano/compare/0.2.0...0.2.1
321
- [0.2.0]: https://github.com/posthtml/htmlnano/compare/0.1.10...0.2.0
322
- [0.1.10]: https://github.com/posthtml/htmlnano/compare/0.1.9...0.1.10
323
- [0.1.9]: https://github.com/posthtml/htmlnano/compare/0.1.8...0.1.9
324
- [0.1.8]: https://github.com/posthtml/htmlnano/compare/0.1.7...0.1.8
325
- [0.1.7]: https://github.com/posthtml/htmlnano/compare/0.1.6...0.1.7
326
- [0.1.6]: https://github.com/posthtml/htmlnano/compare/0.1.5...0.1.6
327
- [0.1.5]: https://github.com/posthtml/htmlnano/compare/0.1.4...0.1.5
328
- [0.1.4]: https://github.com/posthtml/htmlnano/compare/0.1.3...0.1.4
329
- [0.1.3]: https://github.com/posthtml/htmlnano/compare/0.1.2...0.1.3
330
- [0.1.2]: https://github.com/posthtml/htmlnano/compare/0.1.1...0.1.2
331
- [0.1.1]: https://github.com/posthtml/htmlnano/compare/0.1.0...0.1.1
332
-
333
- [#328]: https://github.com/posthtml/htmlnano/issues/328
334
- [#293]: https://github.com/posthtml/htmlnano/issues/293
335
- [#278]: https://github.com/posthtml/htmlnano/issues/278
336
- [#260]: https://github.com/posthtml/htmlnano/issues/260
337
- [#257]: https://github.com/posthtml/htmlnano/issues/257
338
- [#220]: https://github.com/posthtml/htmlnano/issues/220
339
- [#197]: https://github.com/posthtml/htmlnano/issues/197
340
- [#195]: https://github.com/posthtml/htmlnano/issues/195
341
- [#185]: https://github.com/posthtml/htmlnano/issues/185
342
- [#184]: https://github.com/posthtml/htmlnano/issues/184
343
- [#182]: https://github.com/posthtml/htmlnano/issues/182
344
- [#180]: https://github.com/posthtml/htmlnano/issues/180
345
- [#170]: https://github.com/posthtml/htmlnano/issues/170
346
- [#168]: https://github.com/posthtml/htmlnano/issues/168
347
- [#165]: https://github.com/posthtml/htmlnano/issues/165
348
- [#163]: https://github.com/posthtml/htmlnano/issues/163
349
- [#161]: https://github.com/posthtml/htmlnano/issues/161
350
- [#159]: https://github.com/posthtml/htmlnano/issues/159
351
- [#158]: https://github.com/posthtml/htmlnano/issues/158
352
- [#157]: https://github.com/posthtml/htmlnano/issues/157
353
- [#156]: https://github.com/posthtml/htmlnano/issues/156
354
- [#154]: https://github.com/posthtml/htmlnano/issues/154
355
- [#153]: https://github.com/posthtml/htmlnano/issues/153
356
- [#145]: https://github.com/posthtml/htmlnano/issues/145
357
- [#135]: https://github.com/posthtml/htmlnano/issues/135
358
- [#129]: https://github.com/posthtml/htmlnano/issues/129
359
- [#127]: https://github.com/posthtml/htmlnano/issues/127
360
- [#125]: https://github.com/posthtml/htmlnano/issues/125
361
- [#122]: https://github.com/posthtml/htmlnano/issues/122
362
- [#120]: https://github.com/posthtml/htmlnano/issues/120
363
- [#119]: https://github.com/posthtml/htmlnano/issues/119
364
- [#117]: https://github.com/posthtml/htmlnano/issues/117
365
- [#116]: https://github.com/posthtml/htmlnano/issues/116
366
- [#114]: https://github.com/posthtml/htmlnano/issues/114
367
- [#113]: https://github.com/posthtml/htmlnano/issues/113
368
- [#112]: https://github.com/posthtml/htmlnano/issues/112
369
- [#111]: https://github.com/posthtml/htmlnano/issues/111
370
- [#110]: https://github.com/posthtml/htmlnano/issues/110
371
- [#108]: https://github.com/posthtml/htmlnano/issues/108
372
- [#107]: https://github.com/posthtml/htmlnano/issues/107
373
- [#104]: https://github.com/posthtml/htmlnano/issues/104
374
- [#102]: https://github.com/posthtml/htmlnano/issues/102
375
- [#98]: https://github.com/posthtml/htmlnano/issues/98
376
- [#95]: https://github.com/posthtml/htmlnano/issues/95
377
- [#94]: https://github.com/posthtml/htmlnano/issues/94
378
- [#90]: https://github.com/posthtml/htmlnano/issues/90
379
- [#88]: https://github.com/posthtml/htmlnano/issues/88
380
- [#84]: https://github.com/posthtml/htmlnano/issues/84
381
- [#80]: https://github.com/posthtml/htmlnano/issues/80
382
- [#79]: https://github.com/posthtml/htmlnano/issues/79
383
- [#78]: https://github.com/posthtml/htmlnano/issues/78
384
- [#76]: https://github.com/posthtml/htmlnano/issues/76
385
- [#71]: https://github.com/posthtml/htmlnano/issues/71
386
- [#67]: https://github.com/posthtml/htmlnano/issues/67
387
- [#66]: https://github.com/posthtml/htmlnano/issues/66
388
- [#65]: https://github.com/posthtml/htmlnano/issues/65
389
- [#64]: https://github.com/posthtml/htmlnano/issues/64
390
- [#62]: https://github.com/posthtml/htmlnano/issues/62
391
- [#59]: https://github.com/posthtml/htmlnano/issues/59
392
- [#55]: https://github.com/posthtml/htmlnano/issues/55
393
- [#50]: https://github.com/posthtml/htmlnano/issues/50
394
- [#48]: https://github.com/posthtml/htmlnano/issues/48
395
- [#47]: https://github.com/posthtml/htmlnano/issues/47
396
- [#42]: https://github.com/posthtml/htmlnano/issues/42
397
- [#39]: https://github.com/posthtml/htmlnano/issues/39
398
- [#36]: https://github.com/posthtml/htmlnano/issues/36
399
- [#31]: https://github.com/posthtml/htmlnano/issues/31
400
- [#30]: https://github.com/posthtml/htmlnano/issues/30
401
- [#28]: https://github.com/posthtml/htmlnano/issues/28
402
- [#25]: https://github.com/posthtml/htmlnano/issues/25
403
- [#24]: https://github.com/posthtml/htmlnano/issues/24
404
- [#22]: https://github.com/posthtml/htmlnano/issues/22
405
- [#21]: https://github.com/posthtml/htmlnano/issues/21
406
- [#20]: https://github.com/posthtml/htmlnano/issues/20
407
- [#19]: https://github.com/posthtml/htmlnano/issues/19
408
- [#17]: https://github.com/posthtml/htmlnano/issues/17
409
- [#13]: https://github.com/posthtml/htmlnano/issues/13