A robust Python script designed to recursively minify HTML, CSS, and JavaScript files within a specified directory and bundle the optimized output into a single ZIP archive.
This tool guarantees reliable file reduction by using specialized community libraries for CSS/JS, making it perfect for preparing web deployment packages.
- Recursive Minification: Processes all
.html,.css, and.jsfiles in subdirectories. - External Library Use: Leverages dedicated Python libraries (
cssmin,jsmin) for professional-grade optimization. - Safety First: Non-web files (images, fonts, etc.) are safely copied to the output without modification.
- Performance Metrics: Reports the time taken, total bytes saved, and the percentage reduction.
- Clean Output: Creates the final ZIP file and automatically removes all temporary folders.
This script requires Python 3.6+ and a few external libraries.
-
Clone the repository:
git clone https://github.com/GLOXIOU/minimizer-HTML-CSS-JS
-
Install dependencies:
pip install -r requirements.txt
-
Prepare the script: Lunch and have fun !
This script is designed to be run from anywhere on your system. It will prompt you for the directory path it needs to process.
-
Run the script:
python minimizer-HTML-CSS-JS.py
-
Input the absolute path: When prompted, paste the full path to your website's main folder (e.g.,
C:\Users\YourName\MyWebsite\). -
Validation: Type
yesto start the minification process.