3 ms·
It’s great. If you have a static site with no javascript and you want to add some interactivity or replace some reloads with some ajax interactions, html makes
by leephillips 4y ago
It’s great. If you have a static site with no javascript and you want to add some interactivity or replace some reloads with some ajax interactions, html makes it easy to sprinkle this in without having to rewrite the whole thing. It’s very small and efficient, and easy to work with.
> Is there anything holding it back from larger adoption?
I don’t know or care. If I were the only one in the world using it, it would make no difference. It’s self-contained and trivial to self host.
- PaulHoule 4y agoOne thing that "holds it back" is that it doesn't have a general theory of the whole page. A really complex application may have many parts of the UI that are influenced by a piece of data changing. Some examples would be a knowledge graph editor, CAD program, Adobe Photoshop, IDE, etc. There could be a static list of components involved, known at the design time, say a main editor pane and a sidebar and a status bar. In the most complex case, however, the UI could be dynamic and the user could create property sheets and other UI elements that could have an arbitrary number of UI elements that are affected by a data change. It's very possible to write something like that in React although it isn't easy. HTMX doesn't have a theory for the "application" as a whole, rather it is about being able to redraw different parts of the interface, it is probably not that hard to trigger a status bar to redraw in the same event that triggers a div to get redrawed but in general it seems an HTMX application has to be built around what is easy in HTMX.
- leephillips 4y agoYes, no doubt there are many applications for which htmx (or any other tool you can name) are not ideal. For me, I’ve found it useful and easy to add ajax-type progressive enhancements to old-fashioned Django sites, for example. And they work just as before for users without javascript.
- PaulHoule 4y agoThat's what I am doing. I find the "standard model" of writing your application twice these days (write a back end and write a front end) is highly expensive particularly for applications that require agility. I worked at a place where we built a system people would complete tasks (like AMZN's Mechanical Turk) to train machine learning models and it should be quick to just push a new task out to people by writing a new a file, but with the single-page-application you need to not just write the back end but also recompile the front end and force people to reload it. Contrast that to an "old-school" application where you put up a new file and your new task is online. I found HTMX is great for my own model trainer/workflow system. I still can't understand why all the web design shops in my town that were doing great with Ruby on Rails felt compelled to do everything in Angular (which they struggled at) and then ditched angular for React (which they've stuck with.)
- mejutoco 4y agoYou can update several elements of a page in htmx with a single request. Otherwise it would be a deal breaker. I am on the phone but I think this is the attribute https://htmx.org/attributes/hx-swap-oob/ https://htmx.org/attributes/hx-swap-oob/ With it you return several ids and the right elements update. I do exactly that on one of my websites https://fromzerotofullstack.com/ https://fromzerotofullstack.com/
- yawaramin 4y agoIt doesn't have a general theory of the whole page because it's not meant to take over the whole page and turn it into an app. That's what SPA frameworks are for. Htmx is for sprinkling interactions on top of existing server-rendered pages and it works really well for that.