Been doing a small Flask project (mostly a CRUD site) and stumbled upon HTMX:
3 thoughts on “HTMX and Flask is really nice!”
Yep, it’s a really neat little library.
But I feel like returning HTML fragments from certain routes is a bit iffy. I wouldn’t go so far as to call it an anti-pattern but I’ve had my fair share of burns in the past with that kind of approach. Sometimes you want to reuse a route but if the route returns HTML fragments instead of structured data like JSON, there’s a good chance that the returned HTML just won’t fit the surrounding HTML in terms of styling or structure. At that point you’ll have to work with query parameters that control how the returned HTML is rendered or completely different routes that almost do the same thing which can get messy.
My advice: use with caution and only in small projects.
Had a quick squizz at HTMX — I am a complete noob to web dev – client side or other….Have tried my hands at JS – and yep never been able to wrap my head around it totally… Flask on the other hand – is quite enjoyable.
whilst client side JS is a pain in the buttox….I doubt whether something line HTMX would solve that for a noob as myself – cos for most when learning…most content focusses on JS and HTML client side rendering…..
I guess for more experienced devs HTMX would make great sense becos they already know basic JS and just need to spin up something quickly.
With the rise of Vanilla JS as a standard in coding – would HTMX survive that onslaught?
There is a flask extensions