fundon/koa-swig — pull request #6 by lopezchr (2014-10-01 16:35:51+00:00)
Title: Adding the possibility to get the html without write the body

Some times you only need the html for different purposes. For example, if you want to get the html to send an email, or you want to write an ajax response with extra information.

For that reason I added an attribute configuration to add the possibility to disable the auto write response . Additionally the render function, always return the html.

require('koa-swig')(app,{
root: path.join(__dirname, 'views'),
autoescape: true,
cache: 'memory', // disable, set to false
ext: 'html',
wResponse :false,
});

Geting the html....

var html = yield this.render('site/index',{title:'chr-koabase'});
this.type = 'html';
this.body = html;