html-minifier (1) - Linux Manuals

html-minifier: HTML minifier with lint-like capabilities

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-file option (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-comments or --process-scripts options on the command line you must escape those such as --ignore-custom-comments "[\"string1\",\"string1\"]"

OPTIONS

-v, --version
Version information
-o, --output FILE
Specify output file (if not specified STDOUT will be used for output)
-c, --config-file FILE
Use config file
--remove-comments
Strip HTML comments
--remove-comments-from-cdata
Strip HTML comments from scripts and styles
--remove-cdatasections-from-cdata Remove 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-comments STRING
Array of regex'es that allow to ignore certain comments, when matched
--process-scripts STRING
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-length NUMBER
Max line length
-h, --help
Display help and usage details