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