Reputation: 1188
For inststance I need a mixin to wrap any text in defferent HTML elements.
mixin doWrap(myText, myWrapper)
if myWrapper
myWrapper= myText
else
div= myText
So this mixin pseudocode can clarify what I need: when specific wrapper is set, text myText
must be wrapped in it, but if there is no wrapper parameter specified, mixin must use some default HTML element as a wrapper.
So is it possible in Jade to pass a string mixin argument and use the argument as HTML tag?
Upvotes: 0
Views: 219
Reputation: 1188
I found the answer, so it maybe useful for somebody. Tag interpolation can be achieved by using the following code:
#{some_tag}
So my previous example can be modified like this:
mixin doWrap(myText, myWrapper)
if myWrapper
#{myWrapper}= myText
else
div= myText
I haven't found this information in official Jade docs, but here is a link to an issue about it on github
Upvotes: 1