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