DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 968,547 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Arnaldo Gabriel
Arnaldo Gabriel

Posted on

A Quick Way of Minifying an HTML File

Note to self

A quick way of minifying an HTML file including the <style> and <script> tags within it.

  1. Start by installing the HTML minifier with:
    npm install html-minifier -g

  2. Execute the minifier command:
    html-minifier --minify-css true --minify-js true input.htm -o output.htm

Additional options:
--collapse-whitespace
--remove-comments
--remove-optional-tags
--remove-redundant-attributes
--remove-script-type-attributes
--remove-tag-whitespace
--use-short-doctype

Latest comments (1)

Collapse
 
dpaine20 profile image
David Paine20

For the people, who want to do that process, through the online tool, they can use those links as well
url-decode.com/tool/minifyhtml
minifycode.com/
willpeavy.com/tools/minifier/

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.