queckezz/koa-views

How I render the subtemplate?

Closed this issue · 2 comments

If I have three templates: header.html, footer.html and main.html, how I render the three views? I know co-views could, but I don't know how koa-views? thanks~
The below is the co-views example.
co(function *(){
var a = render('user', { user: tobi });
var b = render('user.jade', { user: loki });
var c = render('user.ejs', { user: luna });
var html = yield [a, b, c];
html = html.join('');
console.log(html);
})();

You can't do that now. If you need render the subtemplate,you can use co-views. But I think template engine's Partials and Layouts may be better.

Yea this is not possible since koa-views sends the html as soon as you yield render(). As @demohi stated, you are maybe better off by using co-views directly