htmlnano 2.1.2 → 2.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.
Files changed (191) hide show
  1. package/README.md +54 -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.d.ts +16 -0
  95. package/dist/helpers.js +72 -0
  96. package/dist/helpers.mjs +63 -0
  97. package/dist/index.d.ts +79 -0
  98. package/dist/index.js +223 -0
  99. package/dist/index.mjs +209 -0
  100. package/dist/presets/ampSafe.d.ts +47 -0
  101. package/dist/presets/ampSafe.js +19 -0
  102. package/{lib → dist}/presets/ampSafe.mjs +6 -4
  103. package/dist/presets/max.d.ts +47 -0
  104. package/dist/presets/max.js +28 -0
  105. package/{lib → dist}/presets/max.mjs +6 -4
  106. package/dist/presets/safe.d.ts +47 -0
  107. package/dist/presets/safe.js +60 -0
  108. package/{lib → dist}/presets/safe.mjs +13 -20
  109. package/package.json +53 -56
  110. package/.eslintignore +0 -3
  111. package/CHANGELOG.md +0 -409
  112. package/docs/README.md +0 -33
  113. package/docs/babel.config.js +0 -3
  114. package/docs/docs/010-introduction.md +0 -22
  115. package/docs/docs/020-usage.md +0 -117
  116. package/docs/docs/030-config.md +0 -21
  117. package/docs/docs/040-presets.md +0 -75
  118. package/docs/docs/050-modules.md +0 -855
  119. package/docs/docs/060-contribute.md +0 -16
  120. package/docs/docusaurus.config.js +0 -65
  121. package/docs/netlify.toml +0 -4
  122. package/docs/package-lock.json +0 -21630
  123. package/docs/package.json +0 -40
  124. package/docs/sidebars.js +0 -26
  125. package/docs/versioned_docs/version-1.1.1/010-introduction.md +0 -22
  126. package/docs/versioned_docs/version-1.1.1/020-usage.md +0 -77
  127. package/docs/versioned_docs/version-1.1.1/030-config.md +0 -21
  128. package/docs/versioned_docs/version-1.1.1/040-presets.md +0 -75
  129. package/docs/versioned_docs/version-1.1.1/050-modules.md +0 -785
  130. package/docs/versioned_docs/version-1.1.1/060-contribute.md +0 -16
  131. package/docs/versioned_docs/version-2.0.0/010-introduction.md +0 -22
  132. package/docs/versioned_docs/version-2.0.0/020-usage.md +0 -77
  133. package/docs/versioned_docs/version-2.0.0/030-config.md +0 -21
  134. package/docs/versioned_docs/version-2.0.0/040-presets.md +0 -75
  135. package/docs/versioned_docs/version-2.0.0/050-modules.md +0 -838
  136. package/docs/versioned_docs/version-2.0.0/060-contribute.md +0 -16
  137. package/docs/versioned_sidebars/version-1.1.1-sidebars.json +0 -8
  138. package/docs/versioned_sidebars/version-2.0.0-sidebars.json +0 -8
  139. package/docs/versions.json +0 -4
  140. package/index.cjs +0 -11
  141. package/index.d.cts +0 -3
  142. package/index.d.mts +0 -3
  143. package/index.d.ts +0 -94
  144. package/index.mjs +0 -2
  145. package/lib/helpers.cjs +0 -79
  146. package/lib/helpers.mjs +0 -53
  147. package/lib/htmlnano.cjs +0 -202
  148. package/lib/htmlnano.mjs +0 -198
  149. package/lib/modules/collapseAttributeWhitespace.cjs +0 -86
  150. package/lib/modules/collapseAttributeWhitespace.mjs +0 -104
  151. package/lib/modules/collapseBooleanAttributes.cjs +0 -62
  152. package/lib/modules/collapseWhitespace.cjs +0 -100
  153. package/lib/modules/collapseWhitespace.mjs +0 -132
  154. package/lib/modules/custom.cjs +0 -19
  155. package/lib/modules/custom.mjs +0 -16
  156. package/lib/modules/deduplicateAttributeValues.cjs +0 -38
  157. package/lib/modules/deduplicateAttributeValues.mjs +0 -40
  158. package/lib/modules/example.cjs +0 -85
  159. package/lib/modules/example.mjs +0 -75
  160. package/lib/modules/mergeScripts.cjs +0 -54
  161. package/lib/modules/mergeScripts.mjs +0 -56
  162. package/lib/modules/mergeStyles.cjs +0 -38
  163. package/lib/modules/mergeStyles.mjs +0 -36
  164. package/lib/modules/minifyConditionalComments.cjs +0 -47
  165. package/lib/modules/minifyCss.cjs +0 -73
  166. package/lib/modules/minifyCss.mjs +0 -88
  167. package/lib/modules/minifyJs.cjs +0 -103
  168. package/lib/modules/minifyJs.mjs +0 -121
  169. package/lib/modules/minifyJson.cjs +0 -24
  170. package/lib/modules/minifyJson.mjs +0 -21
  171. package/lib/modules/minifySvg.cjs +0 -37
  172. package/lib/modules/minifySvg.mjs +0 -30
  173. package/lib/modules/minifyUrls.cjs +0 -141
  174. package/lib/modules/minifyUrls.mjs +0 -229
  175. package/lib/modules/normalizeAttributeValues.cjs +0 -120
  176. package/lib/modules/normalizeAttributeValues.mjs +0 -140
  177. package/lib/modules/removeAttributeQuotes.cjs +0 -17
  178. package/lib/modules/removeAttributeQuotes.mjs +0 -12
  179. package/lib/modules/removeComments.cjs +0 -86
  180. package/lib/modules/removeEmptyAttributes.cjs +0 -72
  181. package/lib/modules/removeEmptyAttributes.mjs +0 -121
  182. package/lib/modules/removeOptionalTags.cjs +0 -183
  183. package/lib/modules/removeRedundantAttributes.cjs +0 -112
  184. package/lib/modules/removeUnusedCss.cjs +0 -113
  185. package/lib/modules/removeUnusedCss.mjs +0 -122
  186. package/lib/modules/sortAttributes.cjs +0 -98
  187. package/lib/modules/sortAttributesWithLists.cjs +0 -114
  188. package/lib/presets/ampSafe.cjs +0 -18
  189. package/lib/presets/max.cjs +0 -27
  190. package/lib/presets/safe.cjs +0 -65
  191. package/test.js +0 -23
@@ -1,98 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = sortAttributes;
7
- const validOptions = new Set(['frequency', 'alphabetical']);
8
- const processModuleOptions = options => {
9
- if (options === true) return 'alphabetical';
10
- return validOptions.has(options) ? options : false;
11
- };
12
- class AttributeTokenChain {
13
- constructor() {
14
- this.freqData = new Map(); // <attr, frequency>[]
15
- }
16
- addFromNodeAttrs(nodeAttrs) {
17
- Object.keys(nodeAttrs).forEach(attrName => {
18
- const attrNameLower = attrName.toLowerCase();
19
- if (this.freqData.has(attrNameLower)) {
20
- this.freqData.set(attrNameLower, this.freqData.get(attrNameLower) + 1);
21
- } else {
22
- this.freqData.set(attrNameLower, 1);
23
- }
24
- });
25
- }
26
- createSortOrder() {
27
- let _sortOrder = [...this.freqData.entries()];
28
- _sortOrder.sort((a, b) => b[1] - a[1]);
29
- this.sortOrder = _sortOrder.map(i => i[0]);
30
- }
31
- sortFromNodeAttrs(nodeAttrs) {
32
- const newAttrs = {};
33
-
34
- // Convert node.attrs attrName into lower case.
35
- const loweredNodeAttrs = {};
36
- Object.entries(nodeAttrs).forEach(([attrName, attrValue]) => {
37
- loweredNodeAttrs[attrName.toLowerCase()] = attrValue;
38
- });
39
- if (!this.sortOrder) {
40
- this.createSortOrder();
41
- }
42
- this.sortOrder.forEach(attrNameLower => {
43
- // The attrName inside "sortOrder" has been lowered
44
- if (loweredNodeAttrs[attrNameLower] != null) {
45
- newAttrs[attrNameLower] = loweredNodeAttrs[attrNameLower];
46
- }
47
- });
48
- return newAttrs;
49
- }
50
- }
51
-
52
- /** Sort attibutes */
53
- function sortAttributes(tree, options, moduleOptions) {
54
- const sortType = processModuleOptions(moduleOptions);
55
- if (sortType === 'alphabetical') {
56
- return sortAttributesInAlphabeticalOrder(tree);
57
- }
58
- if (sortType === 'frequency') {
59
- return sortAttributesByFrequency(tree);
60
- }
61
-
62
- // Invalid configuration
63
- return tree;
64
- }
65
- function sortAttributesInAlphabeticalOrder(tree) {
66
- tree.walk(node => {
67
- if (!node.attrs) {
68
- return node;
69
- }
70
- const newAttrs = {};
71
- Object.keys(node.attrs).sort((a, b) => typeof a.localeCompare === 'function' ? a.localeCompare(b) : a - b).forEach(attr => newAttrs[attr] = node.attrs[attr]);
72
- node.attrs = newAttrs;
73
- return node;
74
- });
75
- return tree;
76
- }
77
- function sortAttributesByFrequency(tree) {
78
- const tokenchain = new AttributeTokenChain();
79
-
80
- // Traverse through tree to get frequency
81
- tree.walk(node => {
82
- if (!node.attrs) {
83
- return node;
84
- }
85
- tokenchain.addFromNodeAttrs(node.attrs);
86
- return node;
87
- });
88
-
89
- // Traverse through tree again, this time sort the attributes
90
- tree.walk(node => {
91
- if (!node.attrs) {
92
- return node;
93
- }
94
- node.attrs = tokenchain.sortFromNodeAttrs(node.attrs);
95
- return node;
96
- });
97
- return tree;
98
- }
@@ -1,114 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = collapseAttributeWhitespace;
7
- var _collapseAttributeWhitespace = require("./collapseAttributeWhitespace.cjs");
8
- // class, rel, ping
9
-
10
- const validOptions = new Set(['frequency', 'alphabetical']);
11
- const processModuleOptions = options => {
12
- if (options === true) return 'alphabetical';
13
- return validOptions.has(options) ? options : false;
14
- };
15
- class AttributeTokenChain {
16
- constructor() {
17
- this.freqData = new Map(); // <attrValue, frequency>[]
18
- }
19
- addFromNodeAttrsArray(attrValuesArray) {
20
- attrValuesArray.forEach(attrValue => {
21
- if (this.freqData.has(attrValue)) {
22
- this.freqData.set(attrValue, this.freqData.get(attrValue) + 1);
23
- } else {
24
- this.freqData.set(attrValue, 1);
25
- }
26
- });
27
- }
28
- createSortOrder() {
29
- let _sortOrder = [...this.freqData.entries()];
30
- _sortOrder.sort((a, b) => b[1] - a[1]);
31
- this.sortOrder = _sortOrder.map(i => i[0]);
32
- }
33
- sortFromNodeAttrsArray(attrValuesArray) {
34
- const resultArray = [];
35
- if (!this.sortOrder) {
36
- this.createSortOrder();
37
- }
38
- this.sortOrder.forEach(k => {
39
- if (attrValuesArray.includes(k)) {
40
- resultArray.push(k);
41
- }
42
- });
43
- return resultArray;
44
- }
45
- }
46
-
47
- /** Sort values inside list-like attributes (e.g. class, rel) */
48
- function collapseAttributeWhitespace(tree, options, moduleOptions) {
49
- const sortType = processModuleOptions(moduleOptions);
50
- if (sortType === 'alphabetical') {
51
- return sortAttributesWithListsInAlphabeticalOrder(tree);
52
- }
53
- if (sortType === 'frequency') {
54
- return sortAttributesWithListsByFrequency(tree);
55
- }
56
-
57
- // Invalid configuration
58
- return tree;
59
- }
60
- function sortAttributesWithListsInAlphabeticalOrder(tree) {
61
- tree.walk(node => {
62
- if (!node.attrs) {
63
- return node;
64
- }
65
- Object.keys(node.attrs).forEach(attrName => {
66
- const attrNameLower = attrName.toLowerCase();
67
- if (!_collapseAttributeWhitespace.attributesWithLists.has(attrNameLower)) {
68
- return;
69
- }
70
- const attrValues = node.attrs[attrName].split(/\s/);
71
- node.attrs[attrName] = attrValues.sort((a, b) => {
72
- return typeof a.localeCompare === 'function' ? a.localeCompare(b) : a - b;
73
- }).join(' ');
74
- });
75
- return node;
76
- });
77
- return tree;
78
- }
79
- function sortAttributesWithListsByFrequency(tree) {
80
- const tokenChainObj = {}; // <attrNameLower: AttributeTokenChain>[]
81
-
82
- // Traverse through tree to get frequency
83
- tree.walk(node => {
84
- if (!node.attrs) {
85
- return node;
86
- }
87
- Object.entries(node.attrs).forEach(([attrName, attrValues]) => {
88
- const attrNameLower = attrName.toLowerCase();
89
- if (!_collapseAttributeWhitespace.attributesWithLists.has(attrNameLower)) {
90
- return;
91
- }
92
- tokenChainObj[attrNameLower] = tokenChainObj[attrNameLower] || new AttributeTokenChain();
93
- tokenChainObj[attrNameLower].addFromNodeAttrsArray(attrValues.split(/\s/));
94
- });
95
- return node;
96
- });
97
-
98
- // Traverse through tree again, this time sort the attribute values
99
- tree.walk(node => {
100
- if (!node.attrs) {
101
- return node;
102
- }
103
- Object.entries(node.attrs).forEach(([attrName, attrValues]) => {
104
- const attrNameLower = attrName.toLowerCase();
105
- if (!_collapseAttributeWhitespace.attributesWithLists.has(attrNameLower)) {
106
- return;
107
- }
108
- if (tokenChainObj[attrNameLower]) {
109
- node.attrs[attrName] = tokenChainObj[attrNameLower].sortFromNodeAttrsArray(attrValues.split(/\s/)).join(' ');
110
- }
111
- });
112
- return node;
113
- });
114
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _safe = _interopRequireDefault(require("./safe.cjs"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /**
10
- * A safe preset for AMP pages (https://www.ampproject.org)
11
- */
12
- var _default = exports.default = {
13
- ..._safe.default,
14
- collapseBooleanAttributes: {
15
- amphtml: true
16
- },
17
- minifyJs: false
18
- };
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _safe = _interopRequireDefault(require("./safe.cjs"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /**
10
- * Maximal minification (might break some pages)
11
- */
12
- var _default = exports.default = {
13
- ..._safe.default,
14
- collapseWhitespace: 'all',
15
- removeComments: 'all',
16
- removeAttributeQuotes: true,
17
- removeRedundantAttributes: true,
18
- mergeScripts: true,
19
- mergeStyles: true,
20
- removeUnusedCss: {},
21
- minifyCss: {
22
- preset: 'default'
23
- },
24
- minifySvg: {},
25
- minifyConditionalComments: true,
26
- removeOptionalTags: true
27
- };
@@ -1,65 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /**
8
- * Minify HTML in a safe way without breaking anything.
9
- */
10
- var _default = exports.default = {
11
- /* ----------------------------------------
12
- * Attributes
13
- * ---------------------------------------- */
14
- // normalize the case of attribute names and values
15
- // normalizeAttributeValues will also normalize property value with invalid value default
16
- // See https://html.spec.whatwg.org/#invalid-value-default
17
- normalizeAttributeValues: true,
18
- removeEmptyAttributes: true,
19
- collapseAttributeWhitespace: true,
20
- // removeRedundantAttributes will remove attributes when missing value default matches the attribute's value
21
- // See https://html.spec.whatwg.org/#missing-value-default
22
- removeRedundantAttributes: false,
23
- // collapseBooleanAttributes will also collapse those default state can be omitted
24
- collapseBooleanAttributes: {
25
- amphtml: false
26
- },
27
- deduplicateAttributeValues: true,
28
- minifyUrls: false,
29
- sortAttributes: false,
30
- sortAttributesWithLists: 'alphabetical',
31
- /* ----------------------------------------
32
- * Minify HTML content
33
- * ---------------------------------------- */
34
- collapseWhitespace: 'conservative',
35
- removeComments: 'safe',
36
- minifyConditionalComments: false,
37
- removeOptionalTags: false,
38
- removeAttributeQuotes: false,
39
- /* ----------------------------------------
40
- * Minify inline <style>, <script> and <svg> tag
41
- * ---------------------------------------- */
42
- mergeStyles: false,
43
- mergeScripts: false,
44
- minifyCss: {
45
- preset: 'default'
46
- },
47
- minifyJs: {},
48
- minifyJson: {},
49
- minifySvg: {
50
- plugins: [{
51
- name: 'preset-default',
52
- params: {
53
- overrides: {
54
- collapseGroups: false,
55
- convertShapeToPath: false
56
- }
57
- }
58
- }]
59
- },
60
- removeUnusedCss: false,
61
- /* ----------------------------------------
62
- * Miscellaneous
63
- * ---------------------------------------- */
64
- custom: []
65
- };
package/test.js DELETED
@@ -1,23 +0,0 @@
1
- const fs = require('fs');
2
-
3
- const htmlnano = require('.');
4
- // const posthtml = require('posthtml');
5
- const preset = require('./lib/presets/max.cjs');
6
-
7
-
8
- const html = fs.readFileSync('./test.html', 'utf8');
9
-
10
- const startTime = Date.now();
11
-
12
- htmlnano
13
- // "preset" arg might be skipped (see "Presets" section below for more info)
14
- // "postHtmlOptions" arg might be skipped
15
- .process(html)
16
- .then(function (result) {
17
- // result.html is minified
18
- // console.log(result.html);
19
- console.log(`Time taken: ${Date.now() - startTime}ms`);
20
- })
21
- .catch(function (err) {
22
- console.error(err);
23
- });