Skip to content

Instantly share code, notes, and snippets.

@marioloncarek
Created November 21, 2018 08:28
Show Gist options
  • Save marioloncarek/35dc032ad8dc38ea12fa0a943ca951d1 to your computer and use it in GitHub Desktop.
Save marioloncarek/35dc032ad8dc38ea12fa0a943ca951d1 to your computer and use it in GitHub Desktop.
how to write conditional classes in liquid because of whitespace
<main class="giftcard {% if gift_card.expired or gift_card.enabled != true %} giftcard--disabled{% endif %}">
{%- if gift_card.expired != true and gift_card.expires_on and gift_card.enabled -%}
<span class="giftcard-tag giftcard-tag--active">{{ 'gift_cards.issued.active' | t: expiry: gift_card_expiry_date }}</span>
{%- endif -%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment