-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML + HTMX frontend - AKA Jinja frontend #48
Comments
The answer is yes: https://github.com/mitsuhiko/minijinja/tree/main/minijinja-py |
If "render_fastui_response_with_template_engine" finds a template for the json response based on verb:path (here GET:/API/) then it would be easy as pie to match templates to paths to restitute HTML (or any other format for that matter.) Whatever the rendering engine, a DEBUG switch to push to the browser the source/components/template used to show a piece of code/script/data in the browser would help tremendously in working up the chain to understand the production of the page at any stage. Give the ability to add meta data to the components for use by the rendering engine or CSS in the webpage is also a must. It gives the ability from the backend to allow the frontend to differentiate between same components in presentation if the frontend developer chooses. I think I'm going offtrack :-) Just love this idea, as it allows precisely what HTMX is aimed at, real REST and progressive enhancements. I'll try to help. I'm a bad developer with ideas(the most dangerous kind), but nothing a good code review wouldn't catch before a merge. Thanks |
|
The swifties of HTMX on twitter are asking "why not HTMX?".
While I'm not as enamoured by HTMX as some, there is a good argument to build a frontend that requires no javascript, with optional improvement via HTMX.
The main advantage as I see it is to end users of the applications - less JS to download, less chance of clientside bugs that go unfixed, less chance of something built with this silently breaking in 10 years time when the maintainer is dead.
The real question is how to render the HTML, there are three options:
In the mean time, the only realistic way to do this is option 1.
Are there are python bindings for one of the rust ports of jinja, like minijinja? (@mitsuhiko I seem to remember you talking about this on twitter, does it exist?)
Rather than middleware or a reverse proxy, we could have a function that renders the HTML at return time, so you do something like
One very nice feature of returning JSON from an app is that unit tests are far easier than when returning HTML, therefore whatever solution we end up with (if we end up with on at all 🤷), we should be able to switch off the rendering and return JSON for tests.
The text was updated successfully, but these errors were encountered: