Get started with html-minifier CDN

MIT licensed

The HTML Minifier is a lightweight library that removes unnecessary characters, comments, and whitespace from HTML code to reduce its size and improve page load times.

Tags:
  • cli
  • compress
  • compressor
  • css
  • html
  • htmlmin
  • javascript
  • min
  • minification
  • minifier
  • minify
  • optimize
  • optimizer
  • pack
  • packer
  • parse
  • parser
  • uglifier
  • uglify

Stable version

Copied!

How to start using html-minifier CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with html-minifier CDN - cdnhub.io</title>
    <script src="https://cdn.cdnhub.io/html-minifier/4.0.0/htmlminifier.min.js"></script>
    <script>
        const minify = async () => {
            const originalHTML = document.documentElement.outerHTML;
            const minifiedHTML = await htmMin.minify(originalHTML);
            document.documentElement.outerHTML = minifiedHTML;
        };

        minify();
    </script>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>This is a minified example using HTML Minifier.</p>
</body>
</html>
Copied!
Copied!

All versions