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