A Python tool for minifying web assets by removing unnecessary whitespace, comments, and other redundant content while preserving functionality.
Supports minification of common web file formats:
- HTML (
.html
,.htm
,.xhtml
) - CSS (
.css
) - JSON (
.json
,.webmanifest
) - XML (
.xml
,.rss
,.atom
,.svg
)
All minification preserves full functionality while reducing file size.
# Clone the repository
git clone https://github.com/milesbarr/web-minifier.git
cd web-minifier
# Install the package
pip install .
Minify a single file:
python -m webminifier -i input.html -o output.html
Minify all supported files in a directory:
python -m webminifier -i src/ -o dist/
Recursively minify files in a directory and its subdirectories:
python -m webminifier -i src/ -o dist/ -r
This project is licensed under the MIT license.