I'm trying to AJAXify some functionality of a page that uses Jinja2 and Flask. Problem is that I want the entire Jinja2 template to be rendered by Javascript but, this isn't possible with some of the available libraries as they don't support all the features of jinja2. What's the best way to solve this issue?
-
1Which libraries have you looked at and what are they missing that you need?Sean Vieira– Sean Vieira2013-05-21 12:29:12 +00:00Commented May 21, 2013 at 12:29
-
2I do not understand your question. Jinja is server side rendering using Python. Javascript in your case is client side. For rendering / manipulating client side HTML you use jquery or some other javascript DOM tool or W3C web components with templates (DART).voscausa– voscausa2013-05-21 13:27:54 +00:00Commented May 21, 2013 at 13:27
Add a comment
|
3 Answers
There seems to be https://github.com/syrusakbary/jsjinja library now:
JsJinja lets you use your Jinja2 templates in Javascript. It compile the Jinja2 templates to Javascript with no restrictions.
Not tried it though.
Comments
I've solved this same problem by writing Jasinja. It supports a fairly large subset of the Jinja template syntax.
1 Comment
Roman Susi
This repository has been deleted ?
There is Nunjucks by Mozilla, a templating engine in Javascript inspired by jinja2 that may suit your needs. https://mozilla.github.io/nunjucks/