HTML-MINIFIER-TERSER(1)

πŸ“¦
version 7.2.0~5.5.3 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu resolute

πŸ’– HTML-MINIFIER-TERSER β€” ok bestie, let's shrink some HTML πŸ’–

so like… html-minifier-terser is a JavaScript based HTML minifier. that's the whole vibe. it takes your chunky lil HTML files and makes them ✨svelte✨. iykyk.


🌸 SYNOPSIS 🌸

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

yes that's it. options and files. main character energy fr fr. πŸ’…


✨ OPTIONS ✨

okay so here's the whole menu, no skips, no skimming, we're reading all of it together 🫢

  • -V, --version β€” prints out the version number, that's it, that's the whole job πŸ‘‘
  • --case-sensitive β€” treats attributes in a case sensitive manner (lowkey essential for SVG; think viewBox bestie, viewbox is NOT the same thing) πŸŽ€
  • --collapse-boolean-attributes β€” omits attribute values from boolean attributes. bye bye redundancy πŸ’€
  • --collapse-inline-tag-whitespace β€” collapses white space around inline tag
  • --collapse-whitespace β€” collapses white space that contributes to text nodes in a document tree. so much air, gone 🌬️
  • --conservative-collapse β€” always collapses to 1 space (never removes it entirely). polite collapse, we love her πŸ™ˆ
  • --continue-on-parse-error β€” handles parse errors instead of just aborting. she keeps going, she's resilient ✨
  • --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 β€” uses direct Unicode characters whenever possible. unicode girlies rise 🌈
  • --no-html5 β€” parses 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 β€” inserts tags generated by HTML parser
  • --keep-closing-slash β€” keeps the trailing slash on singleton elements. she stays πŸŽ€
  • --max-line-length <value> β€” max line length
  • --minify-css [value] β€” minifies CSS in style elements and style attributes (uses clean-css)
  • --minify-js [value] β€” minifies Javascript in script elements and on* attributes (uses terser)
  • --minify-urls [value] β€” minifies URLs in various attributes (uses relateurl)
  • --no-newlines-before-tag-close β€” never adds a newline before a tag that closes an element
  • --preserve-line-breaks β€” always collapses to 1 line break (never removes it entirely) when whitespace between tags include a line break
  • --prevent-attributes-escaping β€” prevents the escaping of the values of attributes
  • --process-conditional-comments β€” processes 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 β€” removes quotes around attributes when possible. bare it all πŸ’…
  • --remove-comments β€” strips HTML comments
  • --remove-empty-attributes β€” removes all attributes with whitespace-only values
  • --remove-empty-elements β€” removes all elements with empty contents
  • --remove-optional-tags β€” removes unrequired tags
  • --remove-redundant-attributes β€” removes 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 β€” removes type="text/css" from style and link tags. other type attribute values are left intact
  • --remove-tag-whitespace β€” removes space between attributes whenever possible
  • --sort-attributes β€” sorts attributes by frequency
  • --sort-class-name β€” sorts style classes by frequency
  • --trim-custom-fragments β€” trims white space around ignoreCustomFragments
  • --use-short-doctype β€” replaces the doctype with the short (HTML5) doctype
  • -o, --output <file> β€” specifies output file (if not specified STDOUT will be used for output)
  • -c, --config-file <file> β€” uses config file
  • --input-dir <dir> β€” specifies an input directory
  • --output-dir <dir> β€” specifies an output directory
  • --file-ext <text> β€” specifies an extension to be read, ex: html
  • -h, --help β€” display help for command 🫢

ok that's genuinely the whole list, i counted, we didn't skip a single one, proud of us πŸ’œ

and that's a wrap bestie!! this page is html-minifier-terser 7.2.0, dated November 2023 β€” so if anyone asks, you read the docs, you're built different, periodt. πŸŒŸπŸ’–βœ¨

πŸ“¦ where this page comes from