Python 3 Script to Minify or Compress CSS File Using CSSMinifier API Full Project For Beginners

You are currently viewing Python 3 Script to Minify or Compress CSS File Using CSSMinifier API Full Project For Beginners

 

Welcome folks today in this blog post we will be compressing or minifying css using cssminifier api in python. All the full source code of the application is given below.

 

 

 

Get Started

 

 

 

In order to get started you need to create an app.py file and copy paste the following code

 

But before that just create a style.css file inside the root directory and copy paste the following code into it

 

style.css

 

 

 

 

app.py

 

 

 

And now inside this python snippet we are taking the input css file and then if you execute python script it will compress and minify it and then it will create the output file inside the root directory

 

python app.py

 

After this you will find the output file created which is minified as shown below

 

 

 

 

 

Leave a Reply