Oct 16, 2024
Posted by:
If you are using Python for backend web development it is simple and convenient to use the Python minifier rCSSmin.
The github page for rCSSmin is rCSSmin - A CSS Minifier For Python
Install rcssmin with pip as follows :
pip install rcssmin
If you have a css file named mysite.css, then you can use redirect this file into the Python and it will output the minified css to standard output :
python -m rcssmin < mysite.css
You can redirect the output into a file like this:
python -m rcssmin < mysite.css > mysite.min.css