Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've been using Nunjucks client side and Flask + Jinja2 server side for about a year now. While there's some duplicate effort, it's not as bad as you might imagine.

The duplicate effort: porting some custom Jinja2 filters and plugins from Python to JS. That was a few hours of work on a project that has seen thousands of hours of total work, so down in the noise really. If Python on the server side has big benefits in your problem space, don't let this deter you.

The other thing to be aware of if you want isomorphic templating across JS and Python: Nunjucks is a subset of Jinja2. When I did the Jinja2 -> Nunjucks port, probably 95% of things just worked. The other 5% was either language-idiosyncratic stuff (for example {% set foo = 'bar' %} is scoped to the current block in Nunjucks, but leaks out of block scope in Jinja2) or places where I was being unnecessarily fancy in templates. The port forced me to keep my templates simple and not use the more exotic features of Jinja2, which has turned out to be a good thing.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: