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="/?originalUrl=https%3A%2F%2Friptutorial.com%2F") Home
a(class={active: currentUrl === '/about'} href="/?originalUrl=https%3A%2F%2Friptutorial.com%2Fabout"
<a href="/?originalUrl=https%3A%2F%2Friptutorial.com%2F%26quot%3B%2F%26quot%3B%26gt%3BHome%26lt%3B%2Fa%26gt%3B%26lt%3Ba%2520href%3D%26quot%3B%2Fabout%26quot%3B%2520class%3D%26quot%3Bactive%26quot%3B%26gt%3BAbout%26lt%3B%2Fa%26gt%3B%253C%2Fcode">