[英]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. 我必须打印出一个input
标签和一个label
,在一个标签的末尾和下一个标签的开头之间没有任何空格......但我也想要打印出文档的其余部分。
By default — with pretty printing turned on in Jade — I get the following: 默认情况下 - 在Jade中打开漂亮的打印 - 我得到以下内容:
<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. 来自Jade的想法- 控制HTML输出中的换行符不起作用,因为input
是一个自动关闭标记。
Update 1: I have created the obvious solution using a mixin
and literal HTML, but I would like to avoid that if possible. 更新1:我使用mixin
和文字HTML创建了明显的解决方案,但我想尽可能避免这种情况。
In Razor, I addressed this by wrapping the whitespace with a multi-line comment: 在Razor中,我通过用多行注释包装空白来解决这个问题:
<div>
<span>No trailing</span><!--
--><span>space</span>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.