I'm trying to make a Jade mixin. I want it to omit stuff if I did not input a variable. Maybe it's easier to explain if I show what I mean in code
mixin movie-left-image(title, posterUrl, venue, rating, 3d)
article
h2
strong= title
div
div
img(src = posterUrl)
div
img(src = venue)
img(src = rating)
img(src = 3d)
Not all of the info is known, nor will be available when I use the mixin. So instead of making amillion mixins, like one for when a movie has no rating, or one for when a movie is not available in 3d, I'd like to make just one to cover all these bases.
In this case, say I leave out 3d, I want Jade to ignore 3D at output. But I don't understand how to make Jade ignore 3d if I leave it out. Or any of the other fields, like venue or rating. As in, is it like a null value, or do I have to put everyone of the ones affected in if statements?
Thanks for reading.
You can try to use a conditional to not input some code you don't want, in the case your variable is not specified.