HTMLMinifier is a highly configurable, well-tested, JavaScript-based HTML minifier. Minifier options like sortAttributes and sortClassName won't impact the plain-text size of the output. However, they form long repetitive chains of characters that should improve compression ratio of gzip used in HTTP compression. SVG tags are automatically recognized, and when they are minified, both case-sensitivity and closing slashes are preserved, regardless of the minification settings used for the rest of the file. HTMLMinifier can't work with invalid or partial chunks of markup. This is because it parses markup into a tree structure, then modifies it (removing anything that was specified for removal, ignoring anything that was specified to be ignored, etc.), then it creates a markup out of that tree and returns it.

Features

  • Case-sensitive
  • Attribute values from boolean attributes
  • Collapse inline tag whitespace
  • Decode entity characters
  • Insert tags generated by HTML parser
  • Keep the trailing slash on singleton elements

Project Samples

Project Activity

See All Activity >

Categories

HTML/XHTML

License

MIT License

Follow HTMLMinifier

HTMLMinifier Web Site

Other Useful Business Software
Application Monitoring That Won't Slow Your App Down Icon
Application Monitoring That Won't Slow Your App Down

AppSignal's Rust-based agent is lightweight and stable. Already running in thousands of production apps.

Full APM with errors, performance, logs, and uptime monitoring. 99.999% uptime SLA on the platform itself.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of HTMLMinifier!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript HTML XHTML

Registered

2021-12-10