Skip to main content

Today's npm package: html-minifier

Updated 1 min readMarkdown
Today's npm package: html-minifier

Today's npm package is html-minifier

Optimization is the core goal of Computer Science and can bee applied to small areas like delivering HTML to browsers.

And to optiimize thee HTML delivery, first thing to come in mind is the minification of HTML

html-minifier is going to help us in this direction. Let's see how to use it:

const HTMLMinifier = require("html-minifier");

const minify = HTMLMinifier.minify;

const minifiedHtml = minify(
  '<h1 class="primary" id="main">Title</h1>',
  { removeAttributeQuotes: true }
);

console.log(minifiedHtml);
 // '<h1 class=primary id=main>Title</h1>'

See it in action here: https://runkit.com/pankaj/html-minifier

Stay tuned for tomorrow's package of the Day.

About the author

  • I am developer from India currently based in Berlin, Germany.

    I am very interested in Design, though I don't design 馃槈 I take care of it while making my apps.

    Photography, videography and having random conversation over beer are my activities of spare time. Timelapses and hyperlapses make me wonder all the time 馃槉

No comments yet. Be the first to comment.

More from this blog