davidwarrington / liquid-community-standards

1 stars 0 forks source link

Proposal: Always pad liquid tags with whitespace #4

Open davidwarrington opened 3 years ago

davidwarrington commented 3 years ago

Padding a Liquid tag with whitespace allows room to breathe and reduces visual debt, making your code easier to read.

Examples

Good

{{ title | capitalize }}
{{ description | truncatewords: 30 }}

{%- render 'banner' -%}

{%-
    if collection.products.size >= 50
    or product.tags contains 'pattern:dots'
-%}
    // ...
{%- endif -%}

Bad

{{title | capitalize}}
{{description|truncatewords:30}}

{%-render 'banner'-%}

{%-if collection.products.size >= 50 or product.tags contains 'pattern:dots'-%}
    // ...
{%-endif-%}