mini-html

Minifies a block of HTML or a HTML file

Usage no npm install needed!

<script type="module">
  import miniHtml from 'https://cdn.skypack.dev/mini-html';
</script>

README

miniHTML

A very simple HTML minifier. It will almost definitely break your site if you use PRE or CODE or TEXTAREA with formatting defined by line breaks and tabs etc. Otherwise it will aggressively shrink your HTML.

Usage

Import the node module:

`npm install mini-html`

Minify a HTML file:

var miniHTML = require("mini-html");
var minimized = miniHTML("<html> \n\t<head> \n\t<.......\n\n\n\n\n\t\t\t\t\t\t\t\t\t<body>..."); 
console.log(minimized); // <html><head><..........

Minify a HTML file:

var minimized = miniHTML(null, __dirname + "/index.html");

Minify a HTML file and save it

miniHTML(null, __dirname + "/index.html", true);