chovy chovy - 9 days ago 6
Node.js Question

node express template engine that supports layouts and partials

Is there a good way of doing templating (that allows me to write html -- not jade), that will support layouts and partials?

I have only been able to use ejs with express-partials npm plugin to get this behavior. However I feel the ejs site is out of date and not well supported.

I'm looking for good examples.

I want to create a main layout that would have header + footer and include a separate template for the nav for example.

Knockoutjs looks well supported, but I cannot find many examples of using it with express.

Update: I found a pretty good article here from LinkedIn's evaluation of js templates: http://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more

Answer

I have settled on using visionmedia's ejs with ejs-locals for layouts, includes, and blocks.

https://github.com/RandomEtc/ejs-locals https://github.com/visionmedia/ejs

Comments