经过编译后是
<html> <head></head> <body> <div class="active wrapper">hello this is jade</div> </body> </html>这里使用的语法是属性可以写在()里面,包裹的值空一格就可以书写了
ejs书写格式:
<html> <head></head> <body> <div class="active wrapper">hello this is jade</div> </body> </html>大家可以看到ejs没有啥改变。。
jade中属性中特殊的部分一个是style它可以直接使json数据格式,还有一个是class它可以直接使用数组格式,但也可以使用普通的格式,如果想要都是json数据格式,可以用以下格式引用div&attributes({bacgroundColor:'red'});ejs和jade在语法格式另一个不同在于 html head body div(class=['active','wrapper'],style={height:'100px'}) #{name} div&attributes({ backgroundColor:'red' }) -for(let i=0;i<arry.length;i++) div=arry[i] <html> <head></head> <body> <div class="active wrapper">hello this is jade</div> <%for(let i=0;i<3;i++)%{> <%include a.txt%> <%}%> </body>