I am using django templating, and for readability I have html that looks similar to the following:
{% if some_variable %}
text
{% else %}
nothing exi
I think a front-end development tool, such as grunt-contrib-htmlmin, should be used to minify Django template files before deploying them to production server.
This way, the minification process happens in "build-time", and saves server CPU resource for HTML minification in "run-time".
This tool is originally designed for minifying HTML, but also works for Django templates as I tried out.