[FIXED] Minify HTML output from Flask application with Jinja2 templates

Issue

Is there a Flask or Jinja2 configuration flag / extension to automatically minify the HTML output after rendering the template?

Solution

Have a look here https://github.com/cobrateam/django-htmlmin#using-the-html_minify-function

I realise it is mainly used for django but the example shows how to use this projects code to do what you want with a flask view, i think.

Answered By – olly_uk

Answer Checked By – David Goodson (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published