Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a space character between two <div>s after Jade rendering?

Tags:

html

pug

pugjs

Input:

.a text1
.b text2

Output will be:

<div class="a">text1</div><div class="b">text2</div>

The second <div> is just close to the first one without any spaces or LFs.

However, this is what I really want to get:

<div class="a">text1</div>
<div class="b">text2</div>

or:

<div class="a">text1</div> <div class="b">text2</div>

Because I need to put a space between them when I use display:inline-block. I don't want to set the margin in CSS.

Is it possible to let jade not eat my spaces or LFs?

Thanks,

like image 847
AGamePlayer Avatar asked Oct 02 '22 03:10

AGamePlayer


1 Answers

This block of code

.a text1
| &sp;
.b text2

compile to

<div class="a">text1</div>
&sp;
<div class="b">text2</div>

&sp; is the medium space (http://www.w3.org/)

Update: or use this code

- var space = ' '
.a text1
| #{space}
.b text2
like image 55
madmxg Avatar answered Oct 13 '22 11:10

madmxg