html-minifier (1) Linux Manual Page
NAME
html-minifier – HTML minifier with lint-like capabilities
SYNOPSIS
html-minifier [OPTIONS] [FILE(s)]
DESCRIPTION
HTMLMinifier is a highly configurable, well-tested, Javascript-based HTML minifier, with lint-like capabilities.
USAGE
If no input file(s) specified then STDIN will be used for input.
- If more than one input file specified those will be concatenated and minified together.
- When you specify a config file with the
–config-fileoption (see /usr/share/doc/nodejs-html-minifier/sample-cli-config-file.conf for format) you can still override some of its contents by providing individual command line options, too. - When you want to provide an array of strings for
–ignore-custom-commentsor–process-scriptsoptions on the command line you must escape those such as–ignore-custom-comments"[\"string1\",\"string1\"]"
OPTIONS
-v,–version- Version information
-o,–outputFILE- Specify output file (if not specified STDOUT will be used for output)
-c,–config-fileFILE- Use config file
–remove-comments- Strip HTML comments
–remove-comments-from-cdata- Strip HTML comments from scripts and styles
-
–remove-cdatasections-from-cdataRemove CDATA sections from script and style elements–collapse-whitespace -
- Collapse white space that contributes to text nodes in a document tree.
–conservative-collapse- Always collapse to 1 space (never remove it entirely)
–preserve-line-breaks- Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break.
–collapse-boolean-attributes- Omit attribute values from boolean attributes
–remove-attribute-quotes- Remove quotes around attributes when possible.
–remove-redundant-attributes- Remove attributes when value matches default.
–use-short-doctype- Replaces the doctype with the short (HTML5) doctype
–remove-empty-attributes- Remove all attributes with whitespace-only values
–remove-optional-tags- Remove unrequired tags
–remove-empty-elements- Remove all elements with empty contents
–lint- Toggle linting
–keep-closing-slash- Keep the trailing slash on singleton elements
–case-sensitive- Treat attributes in case sensitive manner (useful for SVG; e.g. viewBox)
–minify-js- Minify Javascript in script elements and on* attributes (uses UglifyJS)
–minify-css- Minify CSS in style elements and style attributes (uses clean-css)
–minify-urls- Minify URLs in various attributes (uses relateurl)
–ignore-custom-commentsSTRING- Array of regex’es that allow to ignore certain comments, when matched
–process-scriptsSTRING- Array of strings corresponding to types of script elements to process through minifier (e.g. "text/ng-template", "text/x-handlebars-template", etc.)
–max-line-lengthNUMBER- Max line length
-h,–help- Display help and usage details
