Skip to content

Instantly share code, notes, and snippets.

@philwolstenholme
Created April 1, 2021 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philwolstenholme/23ad68723a922a62be2d548a55105f35 to your computer and use it in GitHub Desktop.
Save philwolstenholme/23ad68723a922a62be2d548a55105f35 to your computer and use it in GitHub Desktop.
{# List out all the classes we *may* want to use, so they are not purged #}
{% set spacing_levels = {
1: 'u-o-1',
2: 'u-o-2',
3: 'u-o-3',
4: 'u-o-4',
5: 'u-o-5',
6: 'u-o-6',
7: 'u-o-7',
8: 'u-o-8',
} %}
{# Pick a Tailwind class from the lookup table based on the 'spacing' field's value from the CMS. If there is no value from the CMS then use option 3 #}
{% set spacing_level_utility = attribute(spacing_levels, node.field_spacing.value|default(3)) %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment