Node.js template rendering for Co
JavaScript
Latest commit 83a8b2a Jan 29, 2016 @coderhaoxin coderhaoxin v1.0.0
Permalink
Failed to load latest commit information.
examples fix examples and readme Feb 11, 2015
test Switch to Promises instead of thunks Aug 18, 2015
.gitignore Initial commit Sep 6, 2013
Readme.md fix examples and readme Feb 11, 2015
index.js Switch to Promises instead of thunks Aug 18, 2015
package.json v1.0.0 Jan 29, 2016

Readme.md

co-render

Template rendering for co using consolidate.js, providing support for dozens of template engines.

Installation

$ npm install co-render

And install whichever engine(s) you use:

$ npm install ejs jade

Example

Render several users with different template engines in parallel:

var co = require('co');
var render = require('co-render');

var tobi = {
  name: 'tobi',
  species: 'ferret'
};

var loki = {
  name: 'loki',
  species: 'ferret'
};

var luna = {
  name: 'luna',
  species: 'cat'
};

co(function *(){
  var a = render('examples/user.html', { user: tobi, engine: 'swig' });
  var b = render('examples/user.jade', { user: loki });
  var c = render('examples/user.ejs', { user: luna });
  var html = yield [a, b, c];
  html = html.join('');
  console.log(html);
});

License

MIT