Created
January 3, 2017 00:22
-
-
Save craigmdennis/596c6950e53c07f02ac4df064241ecac to your computer and use it in GitHub Desktop.
Pass objects into Pug mixins for default arguments
This file contains hidden or 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
include mixin.pug | |
+navigation_li('Anchor text here', { | |
a_class: 'c-main-navigation__link', | |
li_class: 'active' | |
}) | |
+navigation_li('More anchor text here', { | |
a_class: 'c-main-navigation__link' | |
}) |
This file contains hidden or 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
mixin navigation_li(name, attr) | |
- var li_class = attr.li_class || '' | |
- var a_class = attr.a_class || '' | |
li(class=li_class) | |
a(class=a_class)= name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment