1HTML-MINIFIER(1) User Commands HTML-MINIFIER(1)
2
3
4
6 html-minifier - HTML minifier with lint-like capabilities
7
9 html-minifier [OPTIONS] [FILE(s)]
10
12 HTMLMinifier is a highly configurable, well-tested, Javascript-based
13 HTML minifier, with lint-like capabilities.
14
16 If no input file(s) specified then STDIN will be used for input.
17
18 If more than one input file specified those will be concatenated and
19 minified together.
20
21 When you specify a config file with the --config-file option (see
22 /usr/share/doc/nodejs-html-minifier/sample-cli-config-file.conf for
23 format) you can still override some of its contents by providing indi‐
24 vidual command line options, too.
25
26 When you want to provide an array of strings for --ignore-custom-com‐
27 ments or --process-scripts options on the command line you must escape
28 those such as --ignore-custom-comments "[\"string1\",\"string1\"]"
29
31 -v, --version
32 Version information
33
34 -o, --output FILE
35 Specify output file (if not specified STDOUT will be used for
36 output)
37
38 -c, --config-file FILE
39 Use config file
40
41 --remove-comments
42 Strip HTML comments
43
44 --remove-comments-from-cdata
45 Strip HTML comments from scripts and styles
46
47 --remove-cdatasections-from-cdata Remove CDATA sections from script and
48 style elements
49
50 --collapse-whitespace
51 Collapse white space that contributes to text nodes in a docu‐
52 ment tree.
53
54 --conservative-collapse
55 Always collapse to 1 space (never remove it entirely)
56
57 --preserve-line-breaks
58 Always collapse to 1 line break (never remove it entirely) when
59 whitespace between tags include a line break.
60
61 --collapse-boolean-attributes
62 Omit attribute values from boolean attributes
63
64 --remove-attribute-quotes
65 Remove quotes around attributes when possible.
66
67 --remove-redundant-attributes
68 Remove attributes when value matches default.
69
70 --use-short-doctype
71 Replaces the doctype with the short (HTML5) doctype
72
73 --remove-empty-attributes
74 Remove all attributes with whitespace-only values
75
76 --remove-optional-tags
77 Remove unrequired tags
78
79 --remove-empty-elements
80 Remove all elements with empty contents
81
82 --lint Toggle linting
83
84 --keep-closing-slash
85 Keep the trailing slash on singleton elements
86
87 --case-sensitive
88 Treat attributes in case sensitive manner (useful for SVG; e.g.
89 viewBox)
90
91 --minify-js
92 Minify Javascript in script elements and on* attributes (uses
93 UglifyJS)
94
95 --minify-css
96 Minify CSS in style elements and style attributes (uses
97 clean-css)
98
99 --minify-urls
100 Minify URLs in various attributes (uses relateurl)
101
102 --ignore-custom-comments STRING
103 Array of regex'es that allow to ignore certain comments, when
104 matched
105
106 --process-scripts STRING
107 Array of strings corresponding to types of script elements to
108 process through minifier (e.g. "text/ng-template", "text/x-han‐
109 dlebars-template", etc.)
110
111 --max-line-length NUMBER
112 Max line length
113
114 -h, --help
115 Display help and usage details
116
117
118
119html-minifier December 2014 HTML-MINIFIER(1)