You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been really enjoying JinjaX so far but there's a few things I'd like to change (if I could). Since I'm a newbie I wanted to hear some thoughts of people have more experience than me.
I think it would be great for JinjaX to have static type support including checks. Not sure if this is possible at all because I don't even know if jinja2 supports type checking.
I don't understand the decision to go for single curly braces. It's a bit weird to have both single and double braces in one document.
I think the current documentation would benefit from a do over. Something that's more structured and detailed.
Yes, 100%. In fact, the {# def ... #} declaration can already support built-in types (anything that doesn't require an import), and I think it could be possible to support everything inside the typing module as well. However, I don't have the time to implement it right now. I'm going to add the type check at runtime to the roadmap, though. The static type checking would require plugins for Mypy, Pyright, etc.? I'm not sure.
It comes from React, and the idea was to choose something familiar, however also I didn't want it to be confused with Jinja's {{ }} because they are different.
For example, you can do
<divclass="{{foo}} lorem ipsum {{bar}}">
but you can't do
<Menuclass="{{foo}} lorem ipsum {{bar}}">
because components are translated to function calls before rendering the template:
{{ catalog.irender("Menu", class="{{foo}} lorem ipsum {{bar}}" }}
so I thought it would be confusing.
The syntax is this instead (a single curly braces and no quotes):
<Menuclass={foo+" lorem ipsum "+bar}>
... but I have never really liked it,
...
so I'm seriously considering starting using Vue syntax instead (quotes always, but a : before the name of the attributes that need to be evaluated within the template context):
<Menu:class="foo + ' lorem ipsum ' + bar">
Thoughts?
Agree, it needs some work and many topics are not explained yet: subfolders, integration with different frameworks, etc.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've been really enjoying JinjaX so far but there's a few things I'd like to change (if I could). Since I'm a newbie I wanted to hear some thoughts of people have more experience than me.
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions