From <a href="http://nunjucks.jlongster.com/differences" rel="nofollow">http://nunjucks.jlongster.com/differences</a><p><pre><code> Missing features that will be implemented (in order of priority):
Autoescaping
</code></pre>
I recognize it is first priority, but please mention this on the main page until it is implemented. Given that feature parity is advertised with only "a few subtle differences" my guess is that many people will assume autoescaping.
This is great. It seems strange to me that logicless templates who have taken it too far have gained so much popularity in js templating.<p>For someone considering handlebars, here is what I have found really constraining, note that most of them are by design:<p>- No builtin equality check between two variables. So, you can do:<p><pre><code> `{{#if my_boolean}}`, but cannot do
`{{#if my_variable == 2 }}`
You have two options here:
- Resort to implementing an ifequal helper (and other trivial helpers like gt, lt etc.)
- Prepare everything before handing it to the template, so before passing the json to the template, add another field like, equal_to_two to check for equality with 2.
</code></pre>
- Partials lack access to parent.<p>Say you are iterating over answers of a question, so you do:<p>{{#each answers }}<p>{{ text }} - {{ user }}<p>{{/each}}<p>At some point, you will want to add some information in the parent scope, so you do this:<p>{{#each answers }}<p>{{ answer.text }} - {{ answer.user }} -- in response to {{../user }}<p>{{/each}}<p>Now, you may want to register this snippet as a partial:<p>{{ answer.text }} - {{ answer.user }} -- in response to {{../user }}<p>So that you can do:<p>{{#each answers }}
{{> answer_partial }}
{{/each}}<p>But answer_partial cannot access the parent scope (question item); so you resort to another custom helper "include".<p>- Lack of keyword and delimiter compatibility with Django/Jinja2; so you need to replace each of your {% if %}'s to {{if}} and so on.<p>- It is hard to tell what the current context is referring to at times, so, it is helpful to use an additional debug helper (again not builtin) that just logs the current context. Block helpers change the context, except when they don't.<p>The only reservation I have with nunjucks is that it faces the danger that it might be abandoned like other efforts; other than that, it seems it will address all the painpoints I am experiencing with handlebars, but speaking with jlongster on twitter, he seems determined to keep working on it.
As a person who plays around with Node, has used (and hated) Jade, thank you thank you for doing this. I wanted Jinja for javascript so bad, and EJS simply didn't deliver what I wanted.<p>Let me quickly state something about Jade: I think it's great for those whose philosophy is "as little typing as possible." For me, my goal is simplicity, not minimal typing. That's why I don't like Jade. I can take a Jinja template, show it to somebody who only knows HTML, and they can figure it out rather quickly. Jade, not so much.
Did you find <a href="http://bitbucket.org/djc/jasinja" rel="nofollow">http://bitbucket.org/djc/jasinja</a> before building this?<p>If not, where do you think I should advertise it?
Beautiful. I'm in love with Jinja and this is exactly what I was looking for in JS. Already got github/flosch/pongo for golang so the cycle is complete.<p>Jinja won.<p>Now, let's get the best from all and unify it in a universal templating system, so all languages can build libraries to parse and render the same templates, no matter the language.<p>We all win.
"Mustache is great, but...lacks sophisticated features such as template inheritance"<p>Perhaps my templating needs are trivial, but isn't that what a parial is? Mustache lets you include any template within another template, thereby "inheriting" from the parent.
Cool, and thanks. Did you already see [jsonjinja](<a href="https://github.com/mitsuhiko/jsonjinja" rel="nofollow">https://github.com/mitsuhiko/jsonjinja</a>) ?<p>Nice that you can precompile templates too. Can’t wait to roll this into my brunch template.
Lack of appealing templating was the last technical thing holding me back from experimenting more with client side. Damn, I'm slowly running out of excuses ;-)