Last active
February 16, 2021 22:01
-
-
Save kieranja/99b85c0fe85639362c15c40d92f5cdac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- macro classNames(classes) -%} | |
{%- set final = [] %} | |
{%- for class, isActive in classes.items() -%} | |
{% if isActive %}{% do final.append(class) %}{% endif %} | |
{%- endfor -%} | |
{%- if final|count -%} | |
{{ { "class": final | join(" ") }|xmlattr }} | |
{%- endif -%} | |
{%- endmacro -%} | |
<div {{ classNames({'is-open"/>': true, "is-closed": true, "another-class": true}) }}> | |
hey test | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment