An open API service indexing awesome lists of open source software.

https://github.com/milesbarr/web-minifier

A Python tool for minifying web assets.
https://github.com/milesbarr/web-minifier

css html json minification minifier minify python python3 svg web-app-manifest website xhtml xml

Last synced: 10 months ago
JSON representation

A Python tool for minifying web assets.

Awesome Lists containing this project

README

          

# Web Minifier

A Python tool for minifying web assets by removing unnecessary whitespace,
comments, and other redundant content while preserving functionality.

## Features

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.

## Installation

```bash
# Clone the repository
git clone https://github.com/milesbarr/web-minifier.git
cd web-minifier

# Install the package
pip install .
```

## Usage

### Command-Line Interface

Minify a single file:
```bash
python -m webminifier -i input.html -o output.html
```

Minify all supported files in a directory:
```bash
python -m webminifier -i src/ -o dist/
```

Recursively minify files in a directory and its subdirectories:
```bash
python -m webminifier -i src/ -o dist/ -r
```

## License

This project is licensed under the [MIT license](LICENSE).