Skip to content

alejandrosoares/minify-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MINIFY-PYTHON

Minify html, css and java script files with services of Toptal, through the use of their API and optimize the images of your project to reduce its size.
The script is written in python.

Important

  • The project has been perform in Linux platform and has not been probed in others platforms.
  • The original project is not modified, a copy of the project is created.

Installation

Follow the next steps:

  • Download the folder and place it in the same parent folder as your project. For example:
     parent_folder  
     │
     └───my_project
     │   
     └───minify
    
  • Create a virtualenvironment and install the packages described in requirements.txt.

Usage

  • Run command:
    minify.py source_path destination_path

For example, assuming I have a project named example and I want to put the folder with the minified files in the parent folder of example, the command is:

    minify.py  ./example  ./
  • And the following folder will be created:
parent_folder  
│
└───example
│   
└───minify
│   
└───prod
    │   
    └───example
  • In prod folder there will be copy of example project with the minified files and compressed images.
  • source_path and destination_path are taken from parent folder of minify folder.
  • By default the copy of the project is created inside a folder named prod and the optimization quality is of 65. These and others parameters can be changed minify/settings.py.

Project Files description

minify/
│  minify.py: main file that containing project logic.
│  settings.py: file that contain the configurations.
│  utils.py: file that contain helper functions for minify.py

Contributing

Any pull request are welcome.

Where could we continue?

  • Perform unit tests.
  • Join css files into a main css file.
  • Use some API service to convert images to webp format.

Resources

https://www.toptal.com/developers/cssminifier/python

https://www.toptal.com/developers/javascript-minifier/python

https://www.toptal.com/developers/html-minifier/python

About

Minify html, css and java script files and optimize the images with python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published