如何在jade模板中使用HTML语法

我想专注于学习如何在节点中构build事物,而不必使用jade语法。 我想知道是否有可能在jade模板中混合原生html语法以及循环语法等。如果是这样的话。 如果没有,是否有一个节点模板引擎,将允许这一点。

谢谢。

当然,您可以混合纯HTML和Jade代码,只需使用pipe道文本 。
例如:

| <a href="#">Plain HTML</a> 

这里有一个来自Jade Online Demo的例子(实际上很棒,可以testing某些东西!):

 doctype html html(lang="en") head title= pageTitle script(type='text/javascript'). if (foo) { bar(1 + 5) } body h1 Jade - node template engine #container.col if youAreUsingJade p You are amazing else p Get on it! p. Jade is a terse and simple templating language with a strong focus on performance and powerful features. | <a href="#">Plain HTML</a> 

用这个testing数据:

 { pageTitle: 'Jade Demo', youAreUsingJade: true } 

生成这个代码:

 <!DOCTYPE html> <html lang="en"> <head> <title>Jade Demo</title> <script type="text/javascript"> if (foo) { bar(1 + 5) } </script> </head> <body> <h1>Jade - node template engine</h1> <div id="container" class="col"> <p>You are amazing</p> <p> Jade is a terse and simple templating language with a strong focus on performance and powerful features. </p> </div><a href="#">Plain HTML</a> </body> </html>