Talesoft / tale-jade

A complete and fully-functional implementation of the Jade template language for PHP
http://jade.talesoft.codes
MIT License
88 stars 10 forks source link

How do I use condition in class attribute? #110

Closed YamiOdymel closed 8 years ago

YamiOdymel commented 8 years ago

In other template engine I can simply do:

<div class="label {$isFriend ? 'is-friend' : 'not-friend'} ">

to toggle the class based on my variable, how do I do this in tale-jade?

YamiOdymel commented 8 years ago

Okay I found it here: https://github.com/Talesoft/tale-jade/issues/100

The usage is:

li(class=($var ? "className" : 'className'))
li(class=($var ? "className" : 'className'), class=($var2 ? "className" : 'className'))