All Projects → hamidfzm → Flask Htmlmin

hamidfzm / Flask Htmlmin

Licence: bsd-3-clause
Flask html response minifier

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Flask Htmlmin

Flask And Redis
Simple as dead support of Redis database for Flask applications
Stars: ✭ 76 (+15.15%)
Mutual labels:  flask, flask-extensions
Flask Jsonrpc
A basic JSON-RPC implementation for your Flask-powered sites
Stars: ✭ 223 (+237.88%)
Mutual labels:  flask, flask-extensions
Dynaconf
Configuration Management for Python ⚙
Stars: ✭ 2,082 (+3054.55%)
Mutual labels:  flask, flask-extensions
Flask Mobility
A Flask extension to simplify building mobile-friendly sites.
Stars: ✭ 68 (+3.03%)
Mutual labels:  flask, flask-extensions
Flask Blogging
A Markdown Based Python Blog Engine as a Flask Extension.
Stars: ✭ 609 (+822.73%)
Mutual labels:  flask, flask-extensions
Flask simplelogin
Simple Login - Login Extension for Flask - maintainer @cuducos
Stars: ✭ 133 (+101.52%)
Mutual labels:  flask, flask-extensions
Flask Ask
Alexa Skills Kit for Python
Stars: ✭ 1,877 (+2743.94%)
Mutual labels:  flask, flask-extensions
Flasgger
Easy OpenAPI specs and Swagger UI for your Flask API
Stars: ✭ 2,825 (+4180.3%)
Mutual labels:  flask, flask-extensions
Flask Googlemaps
Easy way to add GoogleMaps to Flask applications. maintainer: @RiverFount
Stars: ✭ 550 (+733.33%)
Mutual labels:  flask, flask-extensions
Potion
Flask-Potion is a RESTful API framework for Flask and SQLAlchemy, Peewee or MongoEngine
Stars: ✭ 484 (+633.33%)
Mutual labels:  flask, flask-extensions
Flask Json
Flask-JSON is a Flask extension providing better JSON support.
Stars: ✭ 34 (-48.48%)
Mutual labels:  flask, flask-extensions
Flask Apscheduler
Adds APScheduler support to Flask
Stars: ✭ 741 (+1022.73%)
Mutual labels:  flask, flask-extensions
Flask Apidoc
Adds ApiDoc support to Flask
Stars: ✭ 49 (-25.76%)
Mutual labels:  flask, flask-extensions
Mead
A Flask project boilerplate for CMS
Stars: ✭ 62 (-6.06%)
Mutual labels:  flask
Helloflask
《Flask Web 开发实战》Meta 仓库
Stars: ✭ 1,135 (+1619.7%)
Mutual labels:  flask
Sensu Grid
A sensu dashboard built for the "big" screen...
Stars: ✭ 62 (-6.06%)
Mutual labels:  flask
Tensorflow 101
learn code with tensorflow
Stars: ✭ 1,116 (+1590.91%)
Mutual labels:  flask
Web develop
《Python Web开发实战》书中源码
Stars: ✭ 1,146 (+1636.36%)
Mutual labels:  flask
Flask Konch
An improved shell command for the Flask CLI
Stars: ✭ 65 (-1.52%)
Mutual labels:  flask
Todo List Using Flask And Mongodb
Simple implementation of ToDo List using Flask and MongoDB along with Dockerfile and Kubernetes yaml files #Flask #Example #Docker #Kubernetes #k8s
Stars: ✭ 61 (-7.58%)
Mutual labels:  flask

Flask-HTMLmin

PyPI version Supported Python Versions License tests codecov

Minify flask text/html mime type responses. Just add MINIFY_HTML = True to your deployment config to minify HTML and text responses of your flask application.

Installation

To install Flask-HTMLmin, simply use pip:

pip install Flask-HTMLmin

Or use pipenv:

pipenv install Flask-HTMLmin

Or use poetry:

poetry add Flask-HTMLmin

Or alternatively, you can download the repository and install it manually by doing:

git clone [email protected]:hamidfzm/Flask-HTMLmin.git
cd Flask-HTMLmin
python setup.py install

Example

from flask import Flask, render_template
from flask_htmlmin import HTMLMIN
    
app = Flask(__name__)
app.config['MINIFY_HTML'] = True

htmlmin = HTMLMIN(app)
# or you can use HTMLMIN.init_app(app)
# pass additional parameters to htmlmin
# HTMLMIN(app, **kwargs)
# example:
# htmlmin = HTMLMIN(app, remove_comments=False, remove_empty_space=True)


@app.route('/')
def main():
    # index.html will be minimized !!!
    return render_template('index.html')


@app.route('/exempt')
@htmlmin.exempt
def exempted_route():
    # index.html will be exempted and not blessed by holy htmlmin !!!
    return render_template('index.html')


if __name__ == '__main__':
    app.run()

TODO

  • [x] Test cases
  • [x] Route (or URL rule) exemption
  • [x] Caching (in progress)
  • [ ] Minify inline CSS
  • [ ] Minify inline Javascript
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].