What is a concise way to create inline elements in Jade

jwerre picture jwerre · Jun 8, 2012 · Viewed 22.8k times · Source

I like to put all my inline elements in a single line.

<ul>
  <li><a>click<span>here</span><strong>!</strong></a></li>

Wondering if there's a better way to create inline elements in Jade than this:

ul
  li 
    a(href="#") click 
      span here
      strong !

This get's a little closer but I'm not sure how to add the span and strong tags without breaking the lines.

ul
  li: a(href='#') click
    span ...

This obviously isn't a super big problem but it's a little annoying that I can't put inline elements inline. Thanks for the help

Answer

pfirpfel picture pfirpfel · Apr 15, 2014

Since version 1.0, jade supports inline tags:

#[tag(attribute='value') inner stuff]

In your case that would be:

ul
  li #[a(href="#") click  #[span here #[strong !]]]