--- id: minify-html version: "0.18.1" license: MIT license_treatment: permissive maintenance: aging --- # minify-html — Extremely fast and smart HTML + JS + CSS minifier License: permissive · Maintenance: aging · Downloads: 1.4M/mo ## What it is and what it does minify-html is a Python binding to a Rust HTML minifier that compresses HTML, JavaScript, and CSS in a single pass. It uses oxc for JavaScript minification and lightningcss for CSS, designed to outperform other minifiers in both speed and compression effectiveness. The package handles invalid HTML and can preserve templating syntax via configuration flags. You import the module and call minify() with your HTML string and optional configuration flags (minify_js, minify_css, keep_comments, etc.). All configuration options default to False if omitted. The binding is built with PyO3 and distributed as precompiled wheels for common platforms; no compilation is required on install for supported systems. Use it for: - Minify HTML templates in a web build pipeline to reduce payload size before deployment. - Strip whitespace and optimize embedded CSS/JS in static site generators or template rendering. - Batch-process HTML files while preserving templating directives like Jinja or Django syntax. - Reduce HTML response size in a web scraper or HTML processing utility. - Optimize HTML email templates for smaller file size and faster transmission. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Minifies HTML, JavaScript, and CSS in a single pass using a Rust-based engine with Python bindings, optimized for both speed and compression ratio. Yes, if you need fast HTML minification with integrated CSS and JS optimization. The permissive MIT license, active repository, and precompiled wheels for common platforms make it low-friction to adopt. Medium install friction only applies if you target uncommon architectures; no known vulnerabilities. Aging maintenance status is a minor concern but not a blocker for a stable utility. ## Install pip install minify-html uv add minify-html poetry add minify-html ## Installing minify-html Before you install: Medium install friction due to precompiled wheels for common platforms (Linux x64/ARM64, macOS x64/ARM64, Windows x64) covering Python 3.10–3.12. Last release was 293 days ago; repository is active and not archived, though maintenance status is aging. License in practice: MIT license is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: pip install minify-html import minify_html minified = minify_html.minify("
Hello
", minify_js=True, minify_css=True) Verify before relying: - Whether precompiled wheels cover all target deployment platforms beyond documented x64/ARM64 Linux, macOS, Windows x64. - Performance comparison with other Python HTML minifiers in your specific use case. - Behavior when minifying HTML with embedded templating syntax beyond documented preservation options. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: medium - Maintenance: aging - Downloads: 1.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags html minifier python, minify html css js, fast html compression, html minification tool, reduce html file size, html css js minifier, web asset minification, html-minification, rust-binding, build-tool [View on SkillFed](https://skillfed.io/packages/minify-html) · [View on PyPI](https://pypi.org/project/minify-html/)