3 ms·
HTMX is neither a meme nor is it anti-javascript, it is literally written in js. It does not aim to remove js from your code, it simply adds more features to H
by oldestofsports 11mo ago
HTMX is neither a meme nor is it anti-javascript, it is literally written in js.
It does not aim to remove js from your code, it simply adds more features to HTML by default, like making any element able to trigger an web request.
When you write a real world app with HTMX, you inevitably end up writing some js, which is totally fine.
- sublinear 11mo agoWhy not just write the js yourself? It's really not that complicated. The people who keep pushing for htmx are weird.
- Swizec 11mo ago> Why not just write the js yourself? It's really not that complicated. The people who keep pushing for htmx are weird. HTMX is great. We use it as a middle ground for mildly interactive parts of the app. Places where jquery/vanilla would get annoying but going full React isn’t worth it. Admin interfaces in particular are a great fit – lots of CRUD, mildly interactive, very repetitive. Adding `hx-get` to a button or div is way way quicker than writing all that boilerplate javascript yet again for the hundredth time. Extra bonus: it encourages you to write small self-contained composable endpoints instead of massive kitchen-sink pages.
- Culonavirus 11mo ago> Admin interfaces in particular are a great fit – lots of CRUD, mildly interactive, very repetitive. Adding `hx-get` to a button or div is way way quicker than writing all that boilerplate javascript yet again for the hundredth time. Yes. Then imagine you have a massive legacy codebase and a control panel of something has a ton of data and buttons and inputs and all kinds of nonsense. Say you have a weight and dimensions of a package of a product... you'd like to make it so you can edit these in-place and when you do, a package volume (and/or volume sum of all packages) gets updated somewhere else on the page (along with some other info... I don't know, an estimate of product delivery cost based on volume, which delivery methods are now un/available etc.) Like... you already have ways to calculate and show these in your server side logic. With HTMX you reuse these, add a sprinkle of hx-get and add some OOB updates and you're done. You can do the same with ajax, but not nearly as fast as with HTMX and much more annoyingly...
- deleted 11mo ago[deleted]
- righthand 11mo agoBecause with HTML you get static, non-flashing, intstantly rendered without load times. So smart developers actually want less Javascript, because the browser already implements most of what Javascript does, why reinvent the wheel? Why would I write React components myself when I the Javascript isn't really that complicated? It is bizarre that ONLY HTMX gets these weird "DONT USE THAT ITS NOT POPULAR ENOUGH" criticisms. XML, XLST get these criticisms except for the XQuery and XPath components because HTML fanatics need that to make their hybrid HTML/JS garbage apps work. But really the ultimate goal for any good website engineer should be to offload as much logic and processing to the browser, not rewrite everything in JS just because you can.
- orhmeh09 11mo ago> But really the ultimate goal for any good website engineer should be to offload as much logic and processing to the browser, not rewrite everything in JS just because you can Why? This makes for a horrible user experience. Things like TicketMaster, and in recent years GitHub, slow my machine to a crawl sometimes. I much prefer mostly static content. This is a well-made website: https://www.compuserve.com/ https://www.compuserve.com/
- johannes1234321 11mo agoWhich isn't JavaScript's failure per se. I wouldn't wat to use a Google Maps like thing, with full page reload each time I scroll or zoom or check details of a place. The issue is of "plain" websites for bad reasons add dynamic stuff.
- on_the_train 11mo agoBecause I don't know js and don't want to touch it
- HiPhish 11mo agoWhy should I write it myself? Sure, I could do that, but then every time I want to have that sort of functionality on multiple pages I would have to write the JavaScript code multiple times. I could then roll it into a library. Maybe make the library work with custom HTML attributes. And now I've just reinvented HTMX. So I might as well use HTMX instead of reinventing it. Such a weird question. You could ask that about any library ever.
- recursivedoubts 11mo agothere's a fair bit of functionality in htmx that isn't trivial: history support, event debouncing, etc. you can certainly write it yourself, but there are advantages to having existing functionality that is well tested and fits together reasonably fixi.js is a more minimalist take on the same idea: https://github.com/bigskysoftware/fixi https://github.com/bigskysoftware/fixi agree that htmx users are weird
- Animats 11mo agoNor is it "local first". It works by remotely pushing HTML into the DOM. It's really a form of push technology.
- kryptn 11mo agohtmx isn't local first. this blog post is about trying to make it 'local first' by introducing a service worker.
- xg15 11mo agoIt is definitely "anti-javascript" or more precisely "anti-SPA". I've read the blog posts.
- zelphirkalt 11mo agoJS != SPA though, no matter how many frontendies want to believe it is equivalent.
- brabel 11mo agoIt’s funny to equate JS with SPA. We’ve had JS on the web since day 1 to add interactivity to otherwise static pages. SPA only became a thing decades later.
- fires10 11mo ago?? Since day1?
- andai 11mo agoDay 1505 by my count. Say, does anyone know Javascript's birthday?
- someothherguyy 11mo agoThere was a pretty long gap between JS being created and people making significant use of it.
- someothherguyy 11mo agohttps://en.wikipedia.org/wiki/Dynamic_HTML https://en.wikipedia.org/wiki/Dynamic_HTML
- michaelcampbell 11mo agoI was there on day 1 of the web and js was not yet even a twinkle in anyone's eye.
- kryptn 11mo agoi decided to use htmx for a frontend for myself and it was a pretty fun experience. even got tailwind involved pretty easily with my rust+maud backend.
- cubefox 11mo ago> HTMX is neither a meme nor is it anti-javascript, it is literally written in js. Java is written in C++, but it is clearly "anti-C++" for any reasonable interpretation of the term. (Java historically replaced C++ as the most popular language, as far as I remember.) More importantly, HTMX could have had native support without requiring an implementation in JavaScript.
- recursivedoubts 11mo agowe are working towards incorporating some of its ideas into the html spec: https://alexanderpetros.com/triptych/ https://alexanderpetros.com/triptych/
- cubefox 11mo agoThank you
- throwaway838112 11mo agoIt is definitely meant to provide an alternative to JS, obviously
- BinaryIgor 11mo agoIt's more like a JS-heavy library that allows you not to write JS, or write it as little and as rarely as possible