Re: jinja and handlebars?
- From:
- Steven Kryskalla
- Date:
- 2012-10-21 @ 04:37
On Sat, Oct 20, 2012 at 8:44 PM, Matthew Hoopes
<matthew.hoopes@gmail.com> wrote:
> I have a bunch of handlebars templates, and they have things like {{#if...
> and {{#else... which screw up the jinja parser. My first inclination, which
> is working, is to wrap every js template in {% raw %}, but that seems
> heavy-handed (at least to me).
You could change the delimiter that jinja2 uses by overriding
Flask.jinja_options, like this:
https://gist.github.com/3925738
Or you could define the mustache templates outside of the jinja
templates, then render them into the template by passing them in
through a variable:
https://gist.github.com/3925780
But that won't work if you want to use jinja variables in the mustache
template. You could use normal string interpolation ('%s', '%d', etc.)
for that.
-steve