Skip to content

Instantly share code, notes, and snippets.

@agmm
Last active May 23, 2019 20:38
Show Gist options
  • Save agmm/3c3d8e2a7eb9ca011c5c1d34ccdbf775 to your computer and use it in GitHub Desktop.
Save agmm/3c3d8e2a7eb9ca011c5c1d34ccdbf775 to your computer and use it in GitHub Desktop.

Start by installing the HTML minifier with:

npm install html-minifier -g

Execute the minifier command:

html-minifier --minify-css true --minify-js true input.htm -o output.htm

Additional options:

html-minifier --collapse-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true input.htm output.htm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment