jqtpl是jQuery模板的express实现
使用方法:
var express = require('express');
var app = module.export = express.createServer();
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'html');
app.register(".html", require("jqtpl").express);
app.use(express.static(__dirname + '/public'));
});
app.get('/', function(req,res){
res.render('index',
{title:'express',content:"hello jqtpl"}
});
模板index.html放到views目录中
<h1>${title}</h1>
<p>%{content}</p>