liquid
liquid copied to clipboard
{%- schema -%} whitespace control
This works:
{%- schema -%}
{
"name": "Main",
"settings": []
}
{% endschema %}
...but adding whitespace control to the closing tag triggers a warning, 'schema' tag was never closed.
{%- schema -%}
{
"name": "Main",
"settings": []
}
{%- endschema -%}
Is it not possible to use whitespace control on {% schema %} tags?
Does this come back as a SyntaxError? Might be a Liquid problem.
EDIT: yes it comes back as a SyntaxError.
Might have to do with the fact that the schema gets stripped away from the file.
Yes, SyntaxError.
Any movement here? This is causing issues with conditionally rendering sections. If I have something like the following:
{%- if condition -%}
<div>actually render something</div>
{%- endif -%}
{% schema %}
{
"tag": "section",
"class": "section",
...
}
{% endschema %}
and
/** CSS somewhere */
.section:empty {
display: none
}
The section is not "empty" although everything that I have control over is outputting nothing, making it impossible with shopify's JSON templates to conditionally "hide" a section based on settings within that section.

Edit: confirmed adding the whitespace control only to the opening tag does not resolve. Also confirmed that there is no new line at EOF that could be causing the whitespace.