HTMLMIN(1)

πŸ“¦
version 0.1.12 Β· 4 versions
, in debian bookworm, ubuntu noble

πŸ’– 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-tags option. '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 to utf-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