6 ms·
If you are on the fence about using htmx in production. my startup[0] uses it exclusively for our frontend (with like 2 lines of hyperscript. It’s sister librar
by jonathan-adly 4y ago
If you are on the fence about using htmx in production. my startup[0] uses it exclusively for our frontend (with like 2 lines of hyperscript. It’s sister library). No complaints and boy, it’s such a fresh breath of increased productivity and still excellent user experience.
We still had to build an API anyway for external organizations using our product, but you still skip a ton of unnecessary JS code.
0. GalenAI.co
- lenkite 3y agoWish htmx supported WASM - ie instead of sending a request to the server, you send the request to the hosted WASM module and render the response. Ideally, one could then use Rust web-frameworks such as Axum on the client side.
- powersnail 4y agoWhat's the back-end? Do you generate those HTML responses via a normal template engine, or is there some sort of deeper integration with HTMX on the backend?
- jonathan-adly 4y agoIt’s Django.. request data in, html response out. That’s all what you need :)
- powersnail 3y agoI'm asking because I've sort of done this in the past, and find creating fragments of HTML with Django's template engine a bit awkward. For instance, if I have some sort of utility button, and say I put it in "utility_button.html", a template file. In practice, I might have to supply different actions, or icon names, or colors when the button is generated, which means that each of these potential variable needs to be a template parameter. Adding a class involves some string manipulation magic. On the other hand, on most client-side front end library, when using a template, I can still slap whatever attributes onto the element, or manipulate its classes as an actual list with relative ease, because front end libraries are more or less already a big HTML parser and generator.
- raihansaputra 4y agoHow do you handle template and fragments? any libraries/usage patterns you use to integrate django <-> htmx?
- neurostimulant 3y agoIf you're lazy, just develop your django app as usual, and use hx-select attribute to select relevant content to use in htmx. Django doesn't have to be aware of the fact that you're using htmx in the client side. https://htmx.org/attributes/hx-select/ https://htmx.org/attributes/hx-select/
- TigerTeamX 3y agoAwesome, thank you!
- globular-toast 3y agoWhy would it need anything special? Django doesn't care what templates contain. You can have a template with literally anything in it, including HTML fragments.
- Dauros 3y agoUsually we have a base template with a content block that a child template can extend. The extend keyword supports variables as well. So we can create a dummy base template, e.g. fragment_base.html, that contains only the content block and if a request is coming from HTMX we set the base template to the dummy one, so the rendered template will contain only the fragment.
- summarity 4y agoSame, using it for https://findsight.ai https://findsight.ai (combined with Alpine). Backend is Nim & karax which makes HTML responses a breeze (fragments and full page).
- jrumbut 3y agoIt took me a second to get the hang of it but your app is cool as hell. I recommend everyone click it. One comment on the UI, on my phone it was not obvious that adding the topic tags was working, because they get added off screen. I was just clicking "ancient-greece" like an idiot for 30 seconds then I accidentally scrolled down and saw what was happening.
- summarity 3y agoThanks, good feedback.
- benji-york 3y agoEchoing another commenter, your app is super cool. Bookmarked. One UI note, the layout jumping around when typing or clicking on things is a little jarring. E.g., the "Word is too short" message pushes the field the user is typing in down the page.
- summarity 3y agoGreat! Yes, all these micro-interactions are something that's on the backlog. I focused on getting the MVP out (it's been here for barely 2 days) and will improve the experience in time.