I have this snippet in a Volt template:
<div class="conditions">
{% if Group is defined %}
{% for Condition in Group.Conditions %}
{{ partial('award/partials/condition',['field':Condition.field,'operator':Condition.operator,'value':Condition.value,'parent_id':Group.id,'id':Condition.id]) }}
{% endfor %}
{% for Group in Group.Groups %}
{{ partial('award/partials/group',['Group':Group]) }}
{% endfor %}
{% endif %}
</div>
As you can see there is indentation (spaces) and newlines. These whitespace characters get included in the rendered HTML, making it impossible for me to target .conditions:empty
in my CSS.
Does volt have a stripwhitespace
tag? Something I could use like:
{% stripwhitespace %}
<div class="conditions">
{% if Group is defined %}
{% for Condition in Group.Conditions %}
{{ partial('award/partials/condition',['field':Condition.field,'operator':Condition.operator,'value':Condition.value,'parent_id':Group.id,'id':Condition.id]) }}
{% endfor %}
{% for Group in Group.Groups %}
{{ partial('award/partials/group',['Group':Group]) }}
{% endfor %}
{% endif %}
</div>
{% endstripwhitespace %}
The rendered result of which would be (assuming Group
is not defined)
<div class="conditions"></div>
I know I could manually remove all the indentation and newlines, but that's hella unreadable.