我正在尝试我在其他问题中看到的没有运气的东西:
我尝试使用覆盖默认引擎配置
app.register('.js.html', {
compiler: function(str,options){...}
});
Run Code Online (Sandbox Code Playgroud)
但是快递js中的注册是未定义的.
我让Bliss以这种方式工作
exports.index = function(req, res){
//res.render('index', {});
res.send(bliss.render(__dirname+"/index",{}));
};
Run Code Online (Sandbox Code Playgroud)
但我想使用res.render('index',输出)代替.
小智 6
你必须这样设置:
var Bliss = new require('bliss');
var bliss = new Bliss();
app.engine('.bliss',function(path,options,fn){
fn(null,bliss.render(path, options));
});
Run Code Online (Sandbox Code Playgroud)
然后你这样称呼它:
exports.index = function(req, res){
res.render('user.bliss', { title: 'Express' });
};
Run Code Online (Sandbox Code Playgroud)
您需要在views目录下有一个名为user.bliss的文件
| 归档时间: |
|
| 查看次数: |
2217 次 |
| 最近记录: |