Scroll to navigation

HTML-MINIFIER-TERSER(1) User Commands HTML-MINIFIER-TERSER(1)

NAME

html-minifier-terser - JavaScript based HTML minifier

SYNOPSIS

html-minifier-terser [options] [files...]

OPTIONS

output the version number
Treat attributes in case sensitive manner (useful for SVG; e.g. viewBox)
Omit attribute values from boolean attributes
Collapse white space around inline tag
Collapse white space that contributes to text nodes in a document tree.
Always collapse to 1 space (never remove it entirely)
Handle parse errors instead of aborting
Arrays of regex'es that allows one to support custom attribute assign expressions (e.g. '<div flex?="{{mode != cover}}"></div>')
Regex that specifies custom attribute to strip newlines from (e.g. /ng-class/)
Arrays of regex'es that allows one to support custom attribute surround expressions (e.g. <input {{#if value}}checked="checked"{{/if}}>)
Arrays of regex'es that allows one to support custom event attributes for minifyJS (e.g. ng-click)
Use direct Unicode characters whenever possible
Parse input according to HTML5 specifications
Array of regex'es that allows one to ignore certain comments, when matched
Array of regex'es that allows one to ignore certain fragments, when matched (e.g. <?php ... ?>, {{ ... }})
Insert tags generated by HTML parser
Keep the trailing slash on singleton elements
Max line length
Minify CSS in style elements and style attributes (uses clean-css)
Minify Javascript in script elements and on* attributes (uses terser)
Minify URLs in various attributes (uses relateurl)
Never add a newline before a tag that closes an element
Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break.
Prevents the escaping of the values of attributes.
Process contents of conditional comments through minifier
Array of strings corresponding to types of script elements to process through minifier (e.g. "text/ng-template", "text/x-handlebars-template", etc.)
Type of quote to use for attribute values (' or ")
Remove quotes around attributes when possible.
Strip HTML comments
Remove all attributes with whitespace-only values
Remove all elements with empty contents
Remove unrequired tags
Remove attributes when value matches default.
Removes the following attributes from script tags: text/javascript, text/ecmascript, text/jscript, application/javascript, application/x-javascript, application/ecmascript. Other type attribute values are left intact
Remove type="text/css" from style and link tags. Other type attribute values are left intact.
Remove space between attributes whenever possible
Sort attributes by frequency
Sort style classes by frequency
Trim white space around ignoreCustomFragments.
Replaces the doctype with the short (HTML5) doctype
Specify output file (if not specified STDOUT will be used for output)
Use config file
Specify an input directory
Specify an output directory
Specify an extension to be read, ex: html
display help for command
November 2023 html-minifier-terser 7.2.0