1 | import * as CleanCSS from "clean-css";
|
2 | import * as RelateUrl from "relateurl";
|
3 | import * as UglifyJS from "uglify-js";
|
4 |
|
5 | export function minify(text: string, options?: Options): string;
|
6 |
|
7 | export interface Options {
|
8 |
|
9 | caseSensitive?: boolean | undefined;
|
10 |
|
11 |
|
12 | collapseBooleanAttributes?: boolean | undefined;
|
13 |
|
14 |
|
15 | collapseInlineTagWhitespace?: boolean | undefined;
|
16 |
|
17 | |
18 |
|
19 |
|
20 |
|
21 | collapseWhitespace?: boolean | undefined;
|
22 |
|
23 |
|
24 | conservativeCollapse?: boolean | undefined;
|
25 | |
26 |
|
27 |
|
28 |
|
29 | continueOnParseError?: boolean | undefined;
|
30 |
|
31 |
|
32 | customAttrAssign?: RegExp[] | undefined;
|
33 |
|
34 |
|
35 | customAttrCollapse?: RegExp | undefined;
|
36 |
|
37 |
|
38 | customAttrSurround?: RegExp[] | undefined;
|
39 |
|
40 |
|
41 | customEventAttributes?: RegExp[] | undefined;
|
42 |
|
43 |
|
44 | decodeEntities?: boolean | undefined;
|
45 |
|
46 |
|
47 | html5?: boolean | undefined;
|
48 |
|
49 |
|
50 | ignoreCustomComments?: RegExp[] | undefined;
|
51 |
|
52 |
|
53 | ignoreCustomFragments?: RegExp[] | undefined;
|
54 |
|
55 |
|
56 | includeAutoGeneratedTags?: boolean | undefined;
|
57 |
|
58 |
|
59 | keepClosingSlash?: boolean | undefined;
|
60 |
|
61 |
|
62 | maxLineLength?: number | undefined;
|
63 |
|
64 |
|
65 | minifyCSS?: boolean | CleanCSS.Options | ((text: string) => string) | undefined;
|
66 |
|
67 | // Minify JavaScript in script elements and event attributes (uses UglifyJS or function specified)
|
68 | minifyJS?: boolean | UglifyJS.MinifyOptions | ((text: string, inline: boolean) => string) | undefined;
|
69 |
|
70 | // Minify URLs in various attributes (uses relateurl or function specified)
|
71 | minifyURLs?: boolean | RelateUrl.Options | ((text: string) => string) | undefined;
|
72 |
|
73 | // Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break. Must be used in conjunction with collapseWhitespace=true
|
74 | preserveLineBreaks?: boolean | undefined;
|
75 |
|
76 | // Prevents the escaping of the values of attributes
|
77 | preventAttributesEscaping?: boolean | undefined;
|
78 |
|
79 | // Process contents of conditional comments through minifier
|
80 | processConditionalComments?: boolean | undefined;
|
81 |
|
82 | // Array of strings corresponding to types of script elements to process through minifier (e.g. text/ng-template, text/x-handlebars-template, etc.)
|
83 | processScripts?: string[] | undefined;
|
84 |
|
85 | // Type of quote to use for attribute values (' or ")
|
86 | quoteCharacter?: string | undefined;
|
87 |
|
88 | /**
|
89 | * Remove quotes around attributes when possible
|
90 | * @see http://perfectionkills.com/experimenting-with-html-minifier/#remove_attribute_quotes
|
91 | */
|
92 | removeAttributeQuotes?: boolean | undefined;
|
93 |
|
94 | /**
|
95 | * Strip HTML comments
|
96 | * @see http://perfectionkills.com/experimenting-with-html-minifier/#remove_comments
|
97 | */
|
98 | removeComments?: boolean | undefined;
|
99 |
|
100 | /**
|
101 | * Remove all attributes with whitespace-only values
|
102 | * @see http://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_or_blank_attributes
|
103 | */
|
104 | removeEmptyAttributes?: boolean | ((attrName: string, tag: string) => boolean) | undefined;
|
105 |
|
106 | /**
|
107 | * Remove all elements with empty contents
|
108 | * @see http://perfectionkills.com/experimenting-with-html-minifier/#remove_empty_elements
|
109 | */
|
110 | removeEmptyElements?: boolean | undefined;
|
111 |
|
112 | /**
|
113 | * Remove optional tags
|
114 | * @see http://perfectionkills.com/experimenting-with-html-minifier/#remove_optional_tags
|
115 | */
|
116 | removeOptionalTags?: boolean | undefined;
|
117 |
|
118 | /**
|
119 | * Remove attributes when value matches default.
|
120 | * @see http://perfectionkills.com/experimenting-with-html-minifier/#remove_redundant_attributes
|
121 | */
|
122 | removeRedundantAttributes?: boolean | undefined;
|
123 |
|
124 | // Remove type="text/javascript" from script tags. Other type attribute values are left intact
|
125 | removeScriptTypeAttributes?: boolean | undefined;
|
126 |
|
127 | // Remove type="text/css" from style and link tags. Other type attribute values are left intact
|
128 | removeStyleLinkTypeAttributes?: boolean | undefined;
|
129 |
|
130 | // Remove space between attributes whenever possible. Note that this will result in invalid HTML!
|
131 | removeTagWhitespace?: boolean | undefined;
|
132 |
|
133 | /**
|
134 | * Sort attributes by frequency
|
135 | *
|
136 | * Minifier options like sortAttributes and sortClassName won't impact the plain-text size
|
137 | * of the output. However, they form long repetitive chains of characters that should improve
|
138 | * compression ratio of gzip used in HTTP compression.
|
139 | *
|
140 | * @see https://github.com/kangax/html-minifier#sorting-attributes--style-classes
|
141 | */
|
142 | sortAttributes?: boolean | undefined;
|
143 |
|
144 | /**
|
145 | * Sort style classes by frequency
|
146 | *
|
147 | * Minifier options like sortAttributes and sortClassName won't impact the plain-text size
|
148 | * of the output. However, they form long repetitive chains of characters that should improve
|
149 | * compression ratio of gzip used in HTTP compression.
|
150 | *
|
151 | * @see https://github.com/kangax/html-minifier#sorting-attributes--style-classes
|
152 | */
|
153 | sortClassName?: boolean | undefined;
|
154 |
|
155 | // Trim white space around ignoreCustomFragments
|
156 | trimCustomFragments?: boolean | undefined;
|
157 |
|
158 | /**
|
159 | * Replaces the doctype with the short (HTML5) doctype
|
160 | * @see http://perfectionkills.com/experimenting-with-html-minifier/#use_short_doctype
|
161 | */
|
162 | useShortDoctype?: boolean | undefined;
|
163 | }
|
164 |
|
\ | No newline at end of file |