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

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

options:
--remove-comments
Strip HTML comments

--remove-empty-attributes
Remove all attributes with whitespace-only values

--remove-empty-elements
Remove all elements with empty contents

--remove-optional-tags
Remove unrequired tags

--remove-redundant-attributes
Remove attributes when value matches default.

Comments

Popular posts from this blog

Redirecting a webpage in JavaScript

What is 'this.' keyword in JavaScript

Introduction to webshare API (navigator.share)