Show HN: Nunjucks – Node templates with inheritance, asynchronous control
jlongster.github.io
jlongster.github.io
It's a great project anyway and it did take 2-3 weeks to decide between the two. Good luck with the project!
The problem I have with swig is that it takes a lot of shortcuts for speed and simplicity of the code. For example, if you have a js function that you call in your template, like {{ foo() }}, the output is not autoescaped ever, regardless of your autoescaping setting. That's dangerous.
Would it help if nunjucks had a "strict" mode that removed a few tags like "set"?
EDIT: that and it seems to be completely against precompiling templates for the browser, which is insane
Unfortunately, SWIG does not run well in the browser. The code is converted with Browserify, and the browser tests only cover the simplest use cases of the library. Thinks broke down horribly as soon as you used a tag ({% extends %}, {% include %}) that needs to load a template.
Is the browser a first-class citizen with Nunjucks? I'd like a library that supports 100% of the features (including compiling templates) in the browser.
If you want to optimize in production, there is advanced support for precompiling your templates as well: http://jlongster.github.io/nunjucks/api.html#precompiling