Hacker Newsnew | past | comments | ask | show | jobs | submit | brucecrust's commentslogin

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.


Every 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.


I’ve been using Jinja2 for years and years, probably around a decade now. I don’t remember any other docs?


Yeah 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.poco...


The answer is not to use a templating engine. TSX is the gold standard here IMO. Using it with https://fresh.deno.dev/ is soooo much nicer than old school templates.


Could 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.


I 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 benefit of filters is that they don’t share the namespace with the template context and I would argue are more readable.


Not 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.


I 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.


I 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.



Wait until you have to work in Mustache/Handlebars, you'd love Jinja


Already here. I work in that industry.


I saw a generic bottle of mayo go for $8.99. I say steal more. The commodification of food is an evil in and of itself; our society is based on profit over people. Let this shit collapse. This is a symptom of economic systems failing people. The problem doesn't lie solely on individuals.


Commodification is the opposite of profit. Every businessperson looking to make more money tries to get OUT of the commodity business.


You wouldn't enjoy what would come next.


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

Search: