The class
attribute can be a string (like any normal attribute) but it can also be an array of class names, which is handy when generated from JavaScript.
- var classes = ['foo', 'bar', 'baz']
a(class=classes)
//- the class attribute may also be repeated to merge arrays
a.bing(class=classes class=['bing'])
<a class="foo bar baz"></a><a class="bing foo bar baz bing"></a>
It can also be an object mapping class names to true or false values, which is useful for applying conditional classes
- var currentUrl = '/about'
a(class={active: currentUrl === '/'} href='/') Home
a(class={active: currentUrl === '/about'} href='/about'
<a href="/">Home</a><a href="/about" class="active">About</a>