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

You Might Also Like
Our Free Plans just got better! | Auth0 by Okta Icon
Our Free Plans just got better! | Auth0 by Okta

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your secuirty. Auth0 now, thank yourself later.
Try free now
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