Art
Art

Reputation: 24577

Templating engine for node.js

I am looking for a templating engine with these specific requirements in mind:

Must have:

Desirable:

Upvotes: 3

Views: 2252

Answers (2)

Tor Valamo
Tor Valamo

Reputation: 33749

Jade is looking like it will become the 'standard' templating language/engine for Node. It is sort of like HAML, except it's totally not HAML. It's way better.

It doesn't have master/child templates, but I've mentioned it to TJ (the author) and I will probably push for it. For now you just need to work bottom-up when rendering templates (ie. applying child templates to parent templates through variables), which I don't see as much of a problem in most cases.

EDIT: Jade does support inheritance now: https://github.com/visionmedia/jade#a11

Upvotes: 2

Art
Art

Reputation: 24577

Looks like simonw's djangode is what I need:

Here's how you load it:

loader.load_and_render('template.html', context, function (error, result) {
    if (error) {
        dj.default_show_500(req, res, error);
    } else {
        dj.respond(res, result, 'text/plain');
    }
});

And template syntax seems to be complete port of Django 1.1 templates

Upvotes: 1

Related Questions