Coder Social home page Coder Social logo

minify-python's Introduction

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

minify-python's People

Contributors

alejandrosoares avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.