HTML-MINIFIER-TERSER(1)
π 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; thinkviewBoxbestie,viewboxis 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 forminifyJS(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 instyleelements and style attributes (usesclean-css)--minify-js [value]β minifies Javascript inscriptelements andon*attributes (usesterser)--minify-urls [value]β minifies URLs in various attributes (usesrelateurl)--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β removestype="text/css"fromstyleandlinktags. 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 aroundignoreCustomFragments--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
- debian trixie: node-html-minifier-terser 7.2.0~5.5.3+repack2-1 Β· MIT
- ubuntu noble: node-html-minifier-terser 7.2.0~5.5.3+repack2-1 Β· MIT
- ubuntu resolute: node-html-minifier-terser 7.2.0~5.5.3+repack2-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms