I am looking for a solution to add "optional chaining" on PugJS to set data-active="true"
if i === 0
.
Bellow is my current code. This code is working, but the problem with this approach (bellow) is that I have to repeat my code on a else
statement and that doesn't make sense. I have to add (i === 0 ? 'data-active="true"' : '')
on the .my__element
, but I don't know how to do it.
if (i === 0)
.my__element(data-month=months[month] data-active="true")
else
.my__element(data-month=months[month])
Any help please? Thank you
Aucun commentaire:
Enregistrer un commentaire