Flask html response minifier
Switch branches/tags
Nothing to show
Clone or download
hamidfzm Update README.md
- Add version badge
- Correct grammar mistakes
- Recommend using pipenv to install
Latest commit 03de233 Dec 1, 2018



PyPi Package Supported Python Versions License Build Status Coverage Status

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


To install Flask-HTMLmin, simply:

pip install Flask-HTMLmin

Or use pipenv (recommended):

pipenv install Flask-HTMLmin

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

git clone git@github.com:hamidfzm/Flask-HTMLmin.git
cd Flask-HTMLmin
python setup.py install


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

htmlmin = HTMLMIN(app)
# or you can use HTMLMIN.init_app(app)
# pass additional parameters to htmlmin
# HTMLMIN(app, **kwargs)

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

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

if __name__ == '__main__':


  • Test cases
  • Route (or URL rule) exemption
  • Caching
  • Minify inline CSS
  • Minify inline Javascript