Вопрос

Is there a way to avoid having to do this?

{{-''-}}  <h2>{{- title -}}</h2>
{{-''-}}  <div class="blah">
{{-''-}}    {{- blah -}}
{{-''-}}    <div class="ha">
{{-''-}}       {{- text -}}
{{-''-}}    </div>
{{-''-}}  </div>
Это было полезно?

Решение

From comments:

There's a Jinja2 extension called HTMLCompress. Its Github page.

Follow the instructions to install it and then wrap parts of markup you want to compress in {% strip %} block:

{% strip %}
<div>
    Whitespace will be removed
</div>
{% endstrip %}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top