6

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?

2
  • 1
    Which libraries have you looked at and what are they missing that you need? Commented May 21, 2013 at 12:29
  • 2
    I 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). Commented May 21, 2013 at 13:27

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

I've solved this same problem by writing Jasinja. It supports a fairly large subset of the Jinja template syntax.

1 Comment

This repository has been deleted ?
1

There is Nunjucks by Mozilla, a templating engine in Javascript inspired by jinja2 that may suit your needs. https://mozilla.github.io/nunjucks/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.