5 ms·
ha man I hate Jinja. Nothing against this or Rust, just from working in Flask I have borderline nightmares. That might say more about my team that the framework
by brucecrust 2y ago
ha man I hate Jinja. Nothing against this or Rust, just from working in Flask I have borderline nightmares. That might say more about my team that the framework though.
- 0cf8612b2e1e 2y agoCould you elaborate? I think it’s fine? Although I have always subscribed to the “Two Scoops” philosophy and keep my templates as stupid as possible. Use a variable, simple conditions, etc. Anything more complex should be handled at a higher level. Go templating on the other hand, that drove me bananas.
- murkt 2y agoI got used to React components, and after that templates feel a bit cumbersome and un-ergonomic in places. I’ve been using Django templates since 2006. Jinja was designed after Django templates of that era, fixing their most glaring problems. Don’t remember the exact year when I started using Jinja a lot. Maybe 2013. For example, a pure existence of an {% include %} tag. People use it, implicitly passing many arguments to some other template. Which makes it very hard to understand and change later. Macros are not that pleasant to use, there are less features in macros then in Python functions, and tools support is much worse too (static analysis, formatting, etc). Filters… why do I need to write `value|string` instead of `str(value)`? Etc.
- the_mitsuhiko 2y agoThe benefit of filters is that they don’t share the namespace with the template context and I would argue are more readable.
- murkt 2y agoNot sharing the same namespace is a benefit, I agree. Not a huge one, as I don’t name my variables “map”, “string” and similar anyway. And would not look favorably if any of my employees did that.
- bityard 2y agoEvery templating engine has to find a balance between doing what you need it to do, and letting you write business logic in the template itself. (Hey there, PHP.) That said, it's possible to write pathlogical templates in just about anything. I've used Jinja a lot and always thought that it struck just about the right balance. The docs are also way better than they used to be.
- IshKebab 2y agoThe answer is not to use a templating engine. TSX is the gold standard here IMO. Using it with https://fresh.deno.dev/ https://fresh.deno.dev/ is soooo much nicer than old school templates.
- murkt 2y agoI’ve been using Jinja2 for years and years, probably around a decade now. I don’t remember any other docs?
- the_mitsuhiko 2y agoYeah the docs never really changed all that much. They look more of less the same for 15 years or so. https://web.archive.org/web/20110727181325/http://jinja.pocoo.org/docs/ https://web.archive.org/web/20110727181325/http://jinja.poco...
- snarkyturtle 2y agoWait until you have to work in Mustache/Handlebars, you'd love Jinja
- golergka 2y agoI worked on a project that implemented static type checking for dbt projects, which are made of SQL templated with jinja and some yaml configs. I'm not sure if I hate it, but it certainly was fun.
- pietz 2y agohttps://jinjax.scaletti.dev/ https://jinjax.scaletti.dev/ cured my pain.
- singhrac 2y agoI have the opposite memory :) I remember writing complex applications in Flask and it just worked right away, and as our performance / complexity grew it kind of kept up because it was very modular.