快递

2013-04-21 136 views
1

使用dotjs我想用dotjs更换玉为快速快递

我改变

app.set('view engine', 'jade'); 

app.set('view engine', 'html');  
app.engine('html', dot.compile); 

,但没有加载很长一段时间,我没有得到回应;

它有什么问题?

+0

你的意思是[this](https://github.com/defunkt/dotjs)?你如何在Express中使用它?这是一个Chrome扩展... – tjameson 2013-04-21 16:16:50

+1

他的意思是http://olado.github.io/doT/index.html – generalhenry 2013-04-21 16:22:30

+0

看看降价的例子,你需要编写你的中间件那样的https://github.com/ visionmedia /快递/斑点/主/示例/降价/ index.js – generalhenry 2013-04-21 16:28:02

回答

2

一个简单的方法是使用快速点:

npm install express-dot 

,并在您app.js:

var doT = require('express-dot'); 
// (optional) set globals any thing you want to be exposed by this in {{= }} and in def {{# }} 
doT.setGlobals({ ... }); 
app.set('view engine', 'dot'); 
app.engine('dot', doT.__express); 

原因,故建议撰写自己的generalhenry说。
如果你这样做,你会明白表达和点更好。
express-dot不支持预编译,所以我在我的Github仓库中有一个简单的pre-compile example
祝你好运。