htmlnano is a modular HTML minifier built on PostHTML, providing a library API, CLI, PostHTML plugin, and webpack integration. It processes HTML through a configurable pipeline of modules (e.g., whitespace collapse, comment removal, CSS/JS/SVG minification) organized into presets (safe, ampSafe, max). The core architecture uses PostHTML's tree walking and a plugin-like module interface where each module can transform attributes, content, or nodes. Optional peer dependencies (cssnano, terser, svgo, etc.) are loaded lazily, and configuration is handled via cosmiconfig. The codebase demonstrates strong engineering with comprehensive test coverage, property-based fuzz testing, and DOM equivalence validation. While primarily a library, it also includes a CLI and webpack adapter, making it a versatile tool for HTML optimization in build pipelines.
WebMarkupMin is a comprehensive .NET library for minifying HTML, XHTML, XML, CSS, and JavaScript markup to optimize web application performance. It provides a core minification engine with parsers and output writers, plus extensive integration with ASP.NET (both classic .NET Framework and .NET Core/5+) through middleware, HTTP modules, MVC action filters, and WebForms base page classes. The library supports multiple minifier backends: built-in Crockford JS and Kristensen CSS minifiers, plus wrappers for Microsoft Ajax Minifier, YUI Compressor, and NUglify. It also includes compression support for GZip, Deflate, and Brotli. The architecture is modular, with clear interfaces (IMarkupMinifier, ICssMinifier, IJsMinifier, ICompressor) and factory patterns, enabling pluggable backends and easy extension. Configuration is exposed via strongly-typed settings classes. The codebase is well-tested with hundreds of unit tests covering edge cases in markup parsing, whitespace handling, attribute optimization, and framework-specific features (Angular, Knockout, Blazor). The repository is primarily a library (not a standalone application), and its samples demonstrate integration with various ASP.NET versions.