How to configure Bliss Templating in express js?

express, node.js

Solution

You have to set it up this way:

var Bliss = new require('bliss');
var bliss = new Bliss();
app.engine('.bliss',function(path,options,fn){
    fn(null,bliss.render(path, options));
});

Then you call it like this:

exports.index = function(req, res){
  res.render('user.bliss', { title: 'Express' });
};

You need a file called user.bliss under the views directory

Problem

I was trying what I've seen in other questions with no luck: - Express.js custom template engine (plate) - node.js + express.js + dust.js issues I tried to override the default engine configuration with ``` app.register('.js.html', { compiler: function(str,options){...} }); ``` but register is undefined in express js. I got Bliss working this way ``` exports.index = function(req, res){ //res.render('index', {}); res.send(bliss.render(__dirname+"/index",{})); }; ``` but I'd like to use res.render('index',output) instead.

Original source

Related problems