Home >Web Front-end >HTML Tutorial >When the jinja2 template generates pages, a large number of blank lines and spaces will be generated. How to remove them? _html/css_WEB-ITnose
For example:
{% if xxx %} # 空行 1something...{% endif %} # 空行 2 # 空行 3{% if xxx %} # 空行 4something...{% endif %} # 空行 5 # 空行 6{% if xxx %} # 空行 7something...{% endif %} # 空行 8
Solution:
Add the "-" symbol to the block.
For example:
------
{%- if test -%}
{%- endif -%}