Jade template how to add text after tag on the same level
Asked Answered
C

2

19

I am try to get this to work in jade template:

html:

<li><i class="icon-comment"></i> 5</li>

jade:

li:i.icon-comment 5

ofcource 5 now is nested under i tag rather then li. Any way to do this?

Connell answered 8/11, 2012 at 22:16 Comment(0)
S
44

In my templates I do it like this:

li
  i.icon-comment
  |  5
Safelight answered 8/11, 2012 at 22:20 Comment(2)
nice thanks.. why is the pipe so magical? What does pipe mean again?Connell
It just puts text after the previous tag. You can read about it in the docs here.Safelight
P
0

There is many ways like:

  1. Like the one shared with david using |
li
  i.icon-comment
  |  5
  1. Add it in single line:
li #[i.icon-comment] 5
Peril answered 22/11, 2020 at 12:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.