我正在使用django模板,为了便于阅读,我的html看起来类似于以下内容:
{% if some_variable %}
text
{% else %}
nothing exists here
{% endif %}
{% for item in set %}
{% if forloop.first %}
...etc...
Run Code Online (Sandbox Code Playgroud)
它在运行时转换为以下html,其中包括大量的空格和返回:
text
<div>
<li
class='some_class
>
some text
</li>
</div>
etc...
Run Code Online (Sandbox Code Playgroud)
在查看页面源时,有些页面甚至可以运行~3,000行html.
有没有工具在运行时压缩这个HTML?如何删除额外的换行符?