0

有没有办法即时编译和渲染 .jade 视图,例如。如果它存储在数据库中,或者是否必须首先将其写入文件系统,或者是否可以挂钩到视图系统来实现这一点。

4

1 回答 1

0

What I know is that Express/Jade allow template modification without restarting the server.

Also, instead of trying to hook Express to render a string, why don't you simply use jade directly and send it to the client ? Few untested, pourly ordered lines of code to help :

var jade = require('jade');    

app.get('/', function(req, res){
    var fn = jade.compile('string of jade');
    res.send(fn(locals));
});
于 2012-04-17T08:55:38.193 回答