你可以使用整洁
以这个玉文件为例:
foo.jade
h1 MyTitle
p
a(class='button', href='/users/') show users
table
thead
tr
th Name
th Email
tbody
- var items = [{name:'Foo',email:'foo@bar'}, {name:'Bar',email:'bar@bar'}]
- each item in items
tr
td= item.name
td= item.email
现在你可以用节点testjade.js foo.jade>处理它了。output.html:
testjade.js
var jade = require('jade');
var jadeFile = process.argv[2];
jade.renderFile(__dirname + '/' + jadeFile, options, function(err, html){
console.log(html);
});
会给你s.th. 喜欢:
output.html
My Title然后用tidy -m output.html整理它将导致:
output.html
/p>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
"HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" />
My Title"text/css" />