HTML minifier module for Nodejs

HTML minification is a process involving striping off unneeded, abundant or otherwise unused HTML attributes and elements without affecting the webpage appearance.

minification is useful for statically genetated 'serverless' web application webpages as it delivers easy to digest minimal webpages

html-minifier is free and open-source npm nodejs module written in JavaScript for minifying HTML documents, as compared to similar nodejs html minification modules html-minifier proves to be pretty fast, flexible and efficient

html-minifier module can be used to minify HTML code programmatically or alternatively you can minify HTML code using global commandline module

Npm module Installation

To install module in your terminal type

npm i html-minifier

To install commandline version of html-minifier in your terminal type

npm i -g html-minifier

html-minifier [options] [files...]

Strip HTML comments

Remove all attributes with whitespace-only values

Remove all elements with empty contents

Remove unrequired tags

Remove attributes when value matches default.


Popular posts from this blog

How to set content disposition header for nginx server to force content download

Animated daylight on HTML5 Canvas

How to make a static http server in nodejs using express

How to make a Snake Game using JavaScript and html5

JS13K Preparation