Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoiding whitespace between tags in Jade template output when pretty printing

I have to print out an input tag and a label without any space between the end of one tag and the start of the next... but I also want to pretty-print the rest of the document.

By default — with pretty printing turned on in Jade — I get the following:

<input ...></input>
<label ...></label>

I want:

<input ...><label ...></label>

or

<input ...></input><label ...></label>

The idea from Jade - Controlling line-breaks in the HTML output doesn't work because input is a self-closing tag.

Update 1: I have created the obvious solution using a mixin and literal HTML, but I would like to avoid that if possible.

like image 999
markvgti Avatar asked Oct 10 '15 05:10

markvgti


1 Answers

In Razor, I addressed this by wrapping the whitespace with a multi-line comment:

    <div>
        <span>No trailing</span><!--
     --><span>space</span>
    </div>
like image 52
Nate Avatar answered Nov 01 '22 09:11

Nate