variable in class name jade

Try this (have not tested):

div(class="flag_#{ session.locale }") session.locale

You can also use conditional statements to do this like

  if liked == true
    span.like.active
  else
    span.like

As for [email protected] works this way:

div(class="flag_" + session.locale) session.locale

Here's another approach:

mixin formButton(text, type, extra_classes)
    - var default_classes = 'btn btn-primary'
    if extra_classes
        - var classes = default_classes + ' ' + extra_classes
    else
        - var classes = default_classes

    if type
        button(class=classes type=type) !{text}
    else
        button(class=classes type="submit") !{text}


Example 1:

Usage:

+formButton('Text')

Result:

<button type="text" class="btn btn-primary" type="submit">Text</button>


Example 2:

Usage:

+formButton('Text', 'button')

Result:

<button type="text" class="btn btn-primary" type="button">Text</button>


Example 3:

Usage:

+formButton('Text', 'button', 'extra-class')

Result:

<button type="text" class="btn btn-primary extra-class" type="button">Text</button>