Minify HTML output from Flask application with Jinja2 templates

前端 未结 7 941
鱼传尺愫
鱼传尺愫 2021-02-02 11:24

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

7条回答
  •  攒了一身酷
    2021-02-02 11:54

    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.

提交回复
热议问题