I'd like to create a button mixin in Jade. However I dont know on which html elements I'll apply those mixin, e.g. a, button or input.
My question: is it possible to choose the element from a mixin? e.g. calling it like this a+button or input+button
or using a element parameter to insert the element with the mixin
mixin button(element, style, size, expand, fill, round, simple)
- var style = (typeof href === 'undefined') ? '' : style
- var fill = (typeof fill === 'undefined') ? '' : 'btn-fill'
- var expand = (typeof expand === 'undefined') ? '' : 'btn-block'
- var round = (typeof round === 'undefined') ? '' : 'btn-round'
- var simple = (typeof simple === 'undefined') ? '' : 'btn-simple'
case size
when "large"
- size = "btn-lg"
when "small"
- size = "btn-sm"
when "mini"
- size = "btn-xs"
element(href=href, role='button',class=["btn", "btn-" + style, size, fill, expand, round, simple])&attributes(attributes)
block
Greetings
Found out by myself:
#{element} solves the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With