Compacting/minifying dynamic html

前端 未结 6 1157
梦如初夏
梦如初夏 2021-01-04 12:21

I am using django templating, and for readability I have html that looks similar to the following:

{% if some_variable %}
    text
{% else %}
    nothing exi         


        
6条回答
  •  遥遥无期
    2021-01-04 12:52

    Looking around I just found django-pipeline, I just tried, by now, the middleware and it's just what I'm expected. It minify all html and text nodes and keep javascript nodes untouched.

    Middleware implementation and basic test result is about 4 minutes, just pip install and activate the middleware after you gzip middleware or on top of your MIDDLEWARE_CLASSES setting.

    https://github.com/cyberdelia/django-pipeline

    http://django-pipeline.readthedocs.org/en/latest/

提交回复
热议问题