HTMLMIN(1)
π HTMLMIN(1) π
okay bestie so this is the manual page for htmlmin, living in section 1 (User Commands) of the manual. it's a configurable HTML Minifier with safety features and honestly? she's iconic. let's get into it π
β¨ NAME β¨
htmlmin β htmlmin is a configurable HTML Minifier with safety features. no cap, that's literally the whole name section, she's lowkey humble π
πΈ DESCRIPTION πΈ
okay so the usage is giving:
usage: htmlmin [-h] [-c] [-s] [--remove-all-empty-space]
[--keep-optional-attribute-quotes] [-H] [-k] [-a PRE_ATTR] [-p
[TAG ...]] [-e ENCODING] [INPUT] [OUTPUT]
and what she does? Minify HTML. periodt. π
π¦ positional arguments π¦
INPUTβ the file path to the html file you wanna minify. if you don't give her one, she defaults to stdin (so she'll just read whatever you pipe in, main character energy).OUTPUTβ the file path to write to. defaults to stdout, so if you say nothing she just yells the result at your terminal. π
β options β
-h,--helpβ show this help message and exit. the classic. the icon. π«Ά-c,--remove-commentsβ when set, comments get removed. but bestie, you can keep them on an individual basis by starting them with a'!':<!--! comment -->. the'!'gets removed from the final output. and if you want a'!'as the leading character of your comment, put two of them:<!--!! comment -->. iykyk β¨-s,--remove-empty-spaceβ when set, this removes empty space between tags in certain cases. specifically, it will remove empty space if and only if a newline character occurs within the space. so code like<span>x</span> <span>y</span>will be left alone, but code such as:
...
</head>
<body>
...
will become ...</head><body>.... note that this CAN break your html if you spread two inline tags over two lines. use with caution. β οΈ
--remove-all-empty-spaceβ when set, this removes ALL empty space between tags. WARNING: this can and likely will cause unintended consequences. for instance,<i>X</i> <i>Y</i>will become<i>X</i><i>Y</i>. putting whitespace along with other text will avoid this problem. only use if you are confident in the result. whitespace is not removed from inside of tags, thus<span> </span>will be left alone. π--keep-optional-attribute-quotesβ when set, this keeps all attribute quotes, even if they are optional. she's not letting go of those quotes, bestie π-H,--in-headβ if you are parsing only a fragment of HTML, and the fragment occurs in the head of the document, setting this will remove some extra whitespace. β¨-k,--keep-pre-attrβ HTMLMin supports the proprietary attribute'pre'that can be added to elements to prevent minification. this attribute is removed by default. set this flag to keep the'pre'attributes in place. π-a PRE_ATTR,--pre-attr PRE_ATTRβ the attribute htmlmin looks for to find blocks of HTML that it should not minify. this attribute will be removed from the HTML unless'-k'is specified. defaults to'pre'. π-p [TAG ...],--pre-tags [TAG ...]β by default, the contents of'pre'and'textarea'tags are left unminified. you can specify different tags using the--pre-tagsoption.'script'and'style'tags are always left unminified. no exceptions, they said what they said. π₯-e ENCODING,--encoding ENCODINGβ encoding to read and write with. default'utf-8'. when reading from stdin, she attempts to use the system's encoding before defaulting toutf-8. π
and that's the whole page, bestie!! this was htmlmin 0.1.12 from October 2022, serving you from the User Commands section of the manual, page HTMLMIN(1). slay, go minify something, and remember to use -s with caution π«Άπβ¨π
π¦ where this page comes from
- debian bookworm: htmlmin 0.1.12-4 Β· BSD-3-Clause
- ubuntu noble: htmlmin 0.1.12-4 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms