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

Open-graph meta data tags introdution

What is 'this.' keyword in JavaScript

How to create zip archives in nodejs

what is 'array.includes' function in JavaScript

How to build a twitter retweet bot using JavaScript