13 ms·
Htmx 4.0
- praseodym 20d agoIs it just a coincidence that the image for this release is the same as for Omarchy Quattro? https://youtu.be/F7fe9pa8OeE https://youtu.be/F7fe9pa8OeE
- recursivedoubts 20d agooh man that's embarassing, someone made that on twitter I didn't realize it was from omarchy, I've removed it, my bad
- chainwax 20d agoI think that's the joke
- tdhz77 19d agoHtmx. And then what’s your mobile strat?
- 93po 19d agoi'd avoid imo, i'm an intern that got fired from htmx and the ceo was a jerk
- alfirous 14d agoYou can become the CEO of HTML instead!
- Baguette5242 20d agoAs CEO of HTMX, I am very proud of the work achieved by the team.
- GrayShade 20d ago> Like it or not, a lot of people are using LLMs and we are providing the following skills files for For what? Don't leave us hanging!
- recursivedoubts 20d agolol sorry about that, had a fix sitting in four-dev, merged to four and pushed, should be updated
- all2 20d agoAs fellow CEO of HTMX, I approve of this statement and concur. I think our next major moves will be to monetize our assets [0]. [0] https://www.youtube.com/watch?v=GyV_UG60dD4 https://www.youtube.com/watch?v=GyV_UG60dD4
- StrangeSound 20d ago> Note that attributes like hx-disinherit Looks like some copy is missing here
- recursivedoubts 20d agoYep, fixed
- mkl 20d ago> (plus at game) Typo of "a"?
- recursivedoubts 20d agowith enough eyes all typos are shallow (it was a long night)
- dormento 20d agoIts ok now you may rest <3 (Congrats on the release)
- arjie 20d agoGreat library. Really enjoy using it. Agents work really well with the kind of site you build with it and it’s very easy to build. Thanks for the upgrade skills.
- nzoschke 20d agoCongrats and thanks! htmx brings me joy. Pretty much every experiment I build now starts with Go, htmx, and SQLite to keep things simple and fast but still responsive. I put a few more thoughts about this here: https://housecat.com/blog/the-hugs-stack-hypermedia-unix-go-sqlite https://housecat.com/blog/the-hugs-stack-hypermedia-unix-go-...
- kaycebasques 20d agoOh wow, interesting combo that I would never independently reach for, but thanks to your template I might have to give it a whirl!
- sgt 20d agoAgreed. In fact, I find Django and Postgres to be the best solution for htmx but Go stack is probably almost as good in terms of developer velocity and obviously much faster. So I think that's a good solution. You can really build powerful production apps with htmx, and what people underestimate is how good it is with AI assisted development (Claude understands it and does it well, and if any JS glue logic on a specific template is required, it's pretty well written and not a mess).
- Analemma_ 20d agoDjango + Postgres on the backend plus a frontend of HTMX + alpine.js for a light touch of interactivity where needed is a killer combination. Claude is very good at it, and with the right instructions actually keeps things concise and modular without spilling into spaghettification. I would recommend this as a first option to anyone looking to spin up a new web stack if you’re not absolutely sure you need the heavyweight of React.
- exographicskip 14d agoI've built a couple non-trivial, cross-platform apps with alpine.js and htmx with tauri as the sole backend with ipc. Claude is very good at full-stack with the tauri mcp driving harder e2e tests that leverage platform APIs.
- deleted 20d ago[deleted]
- sehw 20d ago[dead]
- avarun 20d agoWhy did they skip version 3?
- _doctor_love 20d agoCarson promised they'd never do a version 3...but he never said they couldn't do a version 4.
- gwking 20d agoI'm so pumped for v8!
- recursivedoubts 20d agothis guy gets it
- MichaelNolan 20d agoAs a joke. Back when 2 came out, they promised there would never be a version 3. I.e., no breaking changes. Then they realized they did need to make a breaking change, so the only way to be true to their promise was to skip version 3.
- asdf88990 19d agoThis can be a good summary of htmx overall; a confident solution based on half understanding of the problem domain.
- yawaramin 18d agoYou’ve misunderstood the reason for v4; see https://news.ycombinator.com/item?id=49493929 https://news.ycombinator.com/item?id=49493929
- asdf88990 18d agoNo, you misunderstand what is going on. htmx is an exercising in learning web development by someone who didn’t follow 2 decades of web development progress. He is catching up though, now approaching the early 2010s jQuery (moxi) and backbonejs era with fixiproject.org
- ryanisnan 20d agoCongratulations on the release! I have enjoyed working with htmx very much. I'm still skeptical of htmx being the foundation for a 100-year web service, but I think this is a really worthwhile goal. I'll add that aside from static HTML, I don't have a better option.
- smt88 20d agoThinking about how well your web architecture will hold up for 100 years (or even 10 years) is bikeshedding and a pointless exercise. Perfect is the enemy of good and all that. If something is useful, it’s possible to fix the architecture later. The only counter-example I know of has been GitHub, which was built on RoR and so poorly planned that it’s still biting Microsoft on a regular basis.
- ryanisnan 20d agoSure but it's a spectrum. Surely some choices will age much more poorly than others.
- satvikpendem 20d ago100 years, sure, but 10 years? Definitely not bike shedding, I'd hope your website can stay up for 10 years at least.
- smt88 19d agoYou don’t need to agonize over a library choice to know that your site will be up for 10 years. If it outputs web standards, the browser engines will make sure it is.
- satvikpendem 19d agoYes, unless you choose wrong, which is what we're talking about, as sometimes choosing right is worth the bike shedding.
- mostlysimilar 19d ago
- replwoacause 20d agoI've always been a fan and supporter of HTMX, but lately I've wondered how beneficial it is now that LLMs can generate JavaScript for us. HTMX was especially useful when I wrote JavaScript by hand because I appreciated its higher level of abstraction and simplicity. I also struggled to make it work with AlpineJS and eventually had to resort to plain JavaScript, which gave me finer control. Normally, switching to JavaScript would have been a hassle but since an LLM can produce it as easily as any other text, I’m less clear on HTMX’s advantage. I’ve been getting along fine without it. If computers didn’t write code for us, I would still choose HTMX, but now I find it hard to justify the trade‑off.
- dgabriel 19d agoOut of curiosity, are you defaulting to vanilla js in your agentic dev stack? Or do you have the llm use a framework like react?
- replwoacause 19d agoI've only tried vanilla JS so far
- nchmy 20d agothe browser is and always will be built for dealing with SSR HTML
- replwoacause 20d agoAll apps I build are server-side rendered. I'm not sure how your comment changes the the question I'm asking.
- nchmy 20d agoapologies, i thought you were saying you were switching to SPAs because LLMs understand it better. I see some version of that comment nearly daily now. Carry on!
- kayson 20d agoI'm not very familiar with htmx but at first glance it seems similar to Angular. I thought Angular lost favor because of all the extra attributes and boilerplate. What makes htmx different?
- aaronbrethorst 20d agoHTMX is a layer on top of server-side rendered HTML that gives you near-SPA-levels of interactivity without having to build a standalone SPA.
- recursivedoubts 20d agohtmx is based on the ideas of hypermedia, you can read the first chapter in our book on the topic here: https://hypermedia.systems/hypermedia-a-reintroduction/ https://hypermedia.systems/hypermedia-a-reintroduction/
- Capricorn2481 20d agoHTMX is a polar opposite to Angular in terms of complexity, for one.
- sgt 19d agoHow did you understand Angular to be similar to htmx? They are nearly polar opposites. Can achieve the same though.
- havaloc 20d agoBefore vibe coding was a thing, HTMX made it super easy for me to implement Ajax like features. It was the most approachable library I've ever seen, and I'll always be grateful for it.
- matthew-craig 19d agoWhat about vibe coding makes HTMX something that you speak about in the past tense? Are you just generating frontends in vanilla JS now?
- LVB 19d agoFor me, I know backend development really well, and HTML/CSS passably. HTMX has been much lower friction for me than learning JS frameworks, which tbh I didn't really enjoy, and they were constantly changing. But now, I had mostly leave the JS to Claude, and the HTMX draw has diminished a bit.
- havaloc 19d agoIt's day job tasks/database CRUD, so I tell the LLM what I need. I used to write all my work apps in plain jane PHP/MySQL and I use that as a guide for the LLM, as in use this app as a guide on how I want things. The bonus of using plain PHP/MySQL/PDO is that the apps are small, so no issues with context windows or using complex frameworks.
- james2doyle 20d ago> `hx-alpine-compat` - smooths over compatibility issues between htmx and Alpine.js I looked into this when I tried HTMX 4 on a project earlier this year. I actually found that https://alpine-ajax.js.org/ https://alpine-ajax.js.org/ was smaller than HTMX while providing all the features I needed. It is one of the sanctioned projects they link to so I felt good using it
- recursivedoubts 20d agogreat library, we link to it on our alternatives page
- zanderwohl 20d agoCarson! FYI: "let us rething how extensions can and should work," I think you meant rethink here.
- recursivedoubts 20d agoProof it wasn't AI generated! Thank you!
- zanderwohl 15d agoI understand it can be quite difficult to type with those hooves.
- hnacobsxph 19d agoThe simplicity is the point
- flossly 20d agoI'm glad I'm not using this. It's the opposite of how I like to build web apps (which is either SSR with tiny bits of JS on top that I like to use Alpine.js for; or a JS-app that I like to use Elm for as life is too short runtime errors). Nonetheless I hope all who do use Htmx, enjoy using it.
- anamexis 20d agoI would classify HTMX as a different style of "SSR with tiny bits of JS on top." In fact, I would argue it is a more "pure" form of SSR-based interactive web development than an Alpine.js-style approach (I am not making any value judgment here).
- hackingonempty 20d agoYou can use ReScript with Htmx (or anything else) and get no runtime errors. It has a sound type system, great language.
- flossly 16d agoI like ReScript/Reason. But it's no were close to Elm. Htmx is the opposite of what I like. I will not use it ever for something serious.
- hackingonempty 16d agoHTMX is designed for enhancing web pages, not making full apps on web platform as Elm is. They have different use cases.
- cubefox 20d agoThe anchor links in the "on this page section" don't work for me (Android Firefox/Chrome).
- cui 19d agoIt seems this version is also adding hx-live. Anyone used it before? How does it compare against Alpine.js?
- dec0dedab0de 19d agoI really like htmx, and intercooler.js before it. It's been a while since I tried to convince a co-worker to use it, it might be time to try again. Either way I can't wait to try out the new version. Full Disclosure, I am CEO of HTMX
- jdlshore 19d agoGiven the number of people claiming to be CEO of HTMX, I have to ask: what’s the joke I’m missing?
- stanac 19d agoThere is something here, but I am not sure if it's the whole story: https://htmx.org/essays/lore/ https://htmx.org/essays/lore/
- dec0dedab0de 19d agoyeah, basically recursivedoubts is pretty funny. https://x.com/htmx_org/status/1726986945430233323 https://x.com/htmx_org/status/1726986945430233323
- ecshafer 19d agoOne of the things that is great about htmx (besides being the best library) is the lack of modern silicon valley corpo communication. It has the slightly unhinged feel of a nerd that spent too much time on Newgrounds or 4chan or something awful. Which is how the internet aught to be.
- testdelacc1 19d ago> unhinged Please take a look at the official documentation for htmx, which specifically clarifies that the author owns many hinges.
- deleted 19d ago[deleted]
- hollowturtle 19d ago"On this page" anchor navigation doesn't work for me :( Mobile Safari
- orsenthil 19d agoStrange. The picture of the jeep looks similar to the Omarchy Quatro Desktop wallpaper. Is there a connection? How come both look so similar?
- staticshock 19d agohttps://x.com/htmx_org/status/2093371471817244711 https://x.com/htmx_org/status/2093371471817244711
- philipwhiuk 19d agoThe game page is pretty broken...
- prologic 19d agoHTMX Rocks!
- jamesforestwest 19d agoCool to see htmx alive and evolving. This update was long overdue. The change to attribute inheritance seems a bit debatable to me but maybe it'll actually make the code easier to understand
- seabre 19d agoCan we get a Mitsubishi Delica for the next announcement? Thanks.
- dajonker 19d agoCheers! We've been running the various betas in production for a couple of months now. For our Rails app we replaced most of our Hotwired/Turbo with HTMX. For me at least, HTMX just makes more sense: you control the flow of content from the client, not from the server as you do with Turbo. For pushing updates, we use ActionCable, but we do it in a different way from what we used to do with Turbo Streams: when a record is updated, instead of sending HTML from the server to the client with instructions on what to replace, we only send a small JSON payload with the ID of the element that was updated. On the client side, an event is dispatched that any DOM element with <hx-trigger="<resource-id>:updated from:body"> will trigger on. For the rest it's just basic HTMX, only the trigger is "custom".
- hmokiguess 19d agoFor those wondering, here's how you can join me, the CEO of HTMX, as CEO of HTMX: https://htmx.ceo/ https://htmx.ceo/
- nothrowaways 19d agoThat's a great-looking Toyota. What model is it?
- recursivedoubts 19d ago40 series landcruiser
- closingreunion 19d agoImage seems to be in the same style as the recent Omarchy Quattro header image. Is this a meme?
- jorelfermin 19d agoGreat to see progress continues and the CEOs continue to grow.
- teknico 19d agoCongrats. Relatedly, see also https://data-star.dev/ https://data-star.dev/
- bluesnowmonkey 19d agoI found Htmx to be a great combo with agent driven development. It lets you end-to-end test the UI without a full headless browser by just examing the HTML, which means UI tests are cheap and fast, which means you can have tons of them. And coding agents are exactly as good as your test coverage. So with Htmx they're great.
- thewhitetulip 19d agoWell, if someone is going to vibe code they don't have enough background on searching a good tool. They'll just ask LLM and LLM defaults to a Javascript based thing
- rwoerz 18d agoYou found HTMX?
- miguel-muniz 19d agoAs the CEO of HTMX, I've never used HTMX but I've been keeping an eye on the releases, essays, and talks. Congratulations to the team.
- rednb 19d agoMaybe a contrarian view, but as someone very knowledgeable about .NET API backends + angular on the frontend, I've found that HTMX made things more difficult as it required me to move back to mixing presentation concerns with business-logic and data concerns (basically have the backend produce the UI, which is whole point of HTMX). This is not a criticism but I suspect that the people enjoying HTMX are either people preferring old-school server-side rendering or react users. Just sharing my experience, because HTMX is the absolute darling of hacker news. Since i mainly develop real SPA, i found that is more complex than just using typscrpit if you build something non-trivial as managing state on the server is not fun at all. In my opinion if you are happy using angular, you'll find that HTMX is a step backward in terms for dev experience. Can't speak about react, but since it is not a battery included stack unlike Angular, i can understand why many people find they'd be better off moving things server-side instead of messing around with 15 third-party libraries. My 2 cents
- perardi 19d agoI agree. We are moving away from HTMX at work, to React. (After we moved away from Angular. That was…a choice…that I didn’t make.) Here’s the thing: there’s still a place for HTMX. Lots of places. But “building an SPA but not actually and SPA” is not a lane for HTMX. Nor do they promote HTMX for that purpose. Really quite the opposite. Different tools for different jobs. (Me? I honestly love React, just a more minimal stack. Zustand and TanStack and Vite. No Redux or Next.JS)
- embedding-shape 19d agoYeah, typically I end up building websites (for myself and others) in basically three "lanes". Static HTML/CSS files, great for docs, presentations, reports and similar. Or, websites with some interactive/dynamic elements, HTMX is great for this. Or, fully fledged "client-side apps" where it's more of an application than website, then I go full out dynamic programming with ClojureScript and similar approaches. I'm not sure why so many people seemingly fall into the trap of trying to find one tool and then use that absolutely everywhere. I mean, I'm familiar with it as in "it's fun" as I used Nix as a framework for a static website builder, but I keep seeing people making those sort of choices professionally too. Like when React first became popular, then suddenly people try to jam it into absolutely everything, until they slowly walk back and then after some years agree that maybe it's good for some things, not for everything and not as a default.
- threesmegiste 19d agoA thoughtful, clean, and useful library that wasn't built to climb the corporate ladder. It grew organically. I think it became a cry of relief for those annoyed by unnecessary complexity, which also boosted its recognition. It served as a starting point for things like Datastar, too. I believe it brought a refreshing breath of air to the frontend landscape.
- alsanan 19d agodisappointing: not a mention to "fixi" in any comment. Fixi is the reason htmx 4.0 has come. Fixi is extremately simple but extremately powerful at a time. http://fixiproject.org/ http://fixiproject.org/ Better than htmx IMO.. Same author.
- alkonaut 19d agoAs the CEO of HTMX I find it disturbing that we have more CEO’s than users.
- Foobarsrules 19d agoE
- fatplexer 19d agoE
- metrofun 19d agoF
- tflinton 19d agoI just discovered this and it’s exactly what I’ve been hoping for since 2016. I’m just sorry I’m JUST finding out about it.
- fionic 19d agoThe site is very broken on my iPhone safari. If I click an an anchor reference at the very top (“LLM” let’s say) and try to scroll down because it doesnt link me to the content, it keeps snapping me back to the top after a second.
- michalc 19d agoMost sites/apps I work on are progressively enhanced (https://www.gov.uk/service-manual/technology/using-progressive-enhancement https://www.gov.uk/service-manual/technology/using-progressi...) So far I've used a little bit of htmx (2) for one of them, and I really love it. Just a few attributes and we get some very reasonable progressively enhanced client/server interactive elements without full page loads. Not sure I would choose if I had to make a SPA - it's partially from ignorance, but right not not sure how to avoid spaghetti. But I think it makes me even more strongly consider _not_ making a SPA
- duxuev 19d agoTIL! One more reason to like gov.uk. I had no idea this was a standard but in hindsight it's quite obvious that's the case. I wonder how much of a burden it is at times, and how one can enforce this with automation?
- michalc 18d agoI would say it's only really a burden if you fight it, or don't expect to have to do it and right at the end someone asks "er... does this work without JavaScript?". My attitude is that it's a combination of freeing and a challenge: "we can and should make it simple, even boring" Automatic enforcement for all services is tricky, because you _can_ depend on JavaScript if the user needs justify it.
- huflungdung 19d ago[dead]
- hliyan 19d agoSomewhat of an aside: it's ironic the that some of the clearest, most concise technical documentation I now find on the Internet has come out that way because it was written for a machine: https://raw.githubusercontent.com/bigskysoftware/htmx/v4.0.0/dist/skills/htmx-guidance.md https://raw.githubusercontent.com/bigskysoftware/htmx/v4.0.0... Human readers don't receive this level of care or attention.
- phreack 19d agoIt took me a long time to grok what htmx even was from barely glancing at news articles about it every once in a while. If I'd seen such a concise text explanation I'm sure I'd have got it immediately! Lesson learned: go to LLM docs first I guess?
- DrBazza 19d agoIt's removing all the unnecessary words and fluff. FWIW I adhere to RFC-2119 when writing docs, and tell agents to do so as well.
- Rendello 18d agoI had a similar thought when someone linked [1] Mike Acton's "Data-Oriented Design Operating Rules" [2] written for agents. The text is Claude-y, but the step-by-step DOD guidance is neat, it specifies a development protocol the likes of which I haven't seen elsewhere, besides in Mike's talks (in less detail). 1. https://news.ycombinator.com/item?id=49062520 https://news.ycombinator.com/item?id=49062520 2. https://github.com/macton/nagent/blob/main/context/data-oriented-design.md https://github.com/macton/nagent/blob/main/context/data-orie...
- anonymous344 19d agowhy would i use htmx? whats the user case
- Yash16 19d ago[dead]
- ksec 19d agoCongrats on the release. The next stage is probably some real world comparison between DataStar and HTMX 4.0. Or against Hotwire / Turbo. And perhaps the long term goal is if half if not most of HTMX 4.0 could be inside HTML 5 spec.
- enbugger 19d agoIs it a good idea to code an app with infinite canvas (like Excalidraw) in Htmx?
- konsalexee 18d agoNope, this kind of app will hold a ton of business logic in the JS side, so HTMX is irrelevant in this context.
- kensai 19d agoAccording to their docs "htmx is a library that allows you to access modern browser features directly from HTML, rather than using javascript" Can anyone confirm this claim? How good is this? Doing everything in HTML/CSS might have some advantages. Is it quick and compatible enough?
- troupo 19d agoIt's a Javascript library with several custom DSLs. So yes, it's using Javascript even if you don't do it directly.
- EmilStenstrom 19d agoYes, I can confirm. The main advantage is that you can build a site that feels like a React site, but with 100x less code, and no frontend to maintain.
- yawaramin 18d agoWhere does it say that exactly?
- deleted 19d ago[deleted]
- WillAdams 19d agoI have been reading: https://www.goodreads.com/book/show/192405005-hypermedia-systems https://www.goodreads.com/book/show/192405005-hypermedia-sys... and still having a hard time wrapping my mind around all of this. The thing which I would really like to see is a stand-alone IDE with a straight-forward "Hello World" as an on-ramp.
- yawaramin 17d agoThat's super simple, it's your favourite backend web framework. Rails, Spring Boot, Laravel, Django, Flask, FastAPI...really whatever you like.
- chrisweekly 19d agoI don't like htmx. Compared to component-based approaches, its template / DOM / HTTP-fragment contracts are harder to share, type-check, version, and compose. Application behavior is distributed among: - Markup attributes and DOM structure - HTTP endpoints that return fragments rather than whole documents - Swap rules and event hooks - Form / query-string / hidden-field state - Any supplemental JavaScript for widgets and client-only behavior IME, htmx doesn't remove complexity, it just relocates it. Context: doing webdev for a living since 1998.
- hit8run 19d agoAs CEO of HTMX I am proud of what we have achieved.
- novoreorx 19d agoCan anyone convince me why I should choose HTMX rather than vanilla JS for "sites with limited interactivity"?
- asdfsa32 19d agoAnd by the looks of it, the Author is starting to understand the reason React and the likes exists and has start to build them over again: https://fixiproject.org/ https://fixiproject.org/ LOL. Frontend dev never changes.
- yawaramin 18d agoWhat part of the Fixi project is building something like React?
- asdfsa32 18d agoNot react yet, but it is approaching the early 2010 jQuery and Backbone vibes, so give it another 5 years and it will converge to React.
- yawaramin 17d agoThe htmx creator has made similar things for a long time, if anything htmx has diverged from those ideas by taking Intercooler.js and stripping out the bundled jQuery to simplify it and create htmx. See https://news.ycombinator.com/item?id=49496634 https://news.ycombinator.com/item?id=49496634
- asdfsa32 17d agoHave you looked at the project for which htmx4 is released for? it is basically mvc + toolbelt + network library and all that jazz like it is 2012.
- deadbabe 19d agoMaybe I’m missing something, but why would you want HTMX server side rendering, rather than a restful API that can return platform-agnostic data structures that you could render in various contexts, like a SPA, or a mobile app, or a terminal app, etc?
- moebrowne 18d agoBecause serialisation and deserialisation have a price and you almost never need what you describe
- deadbabe 18d agoWho pays it? And I disagree, we definitely use the same API for other contexts.
- yawaramin 17d agoThe client pays it. - If the server is responding with JSON, the client has to parse, decode, and validate the JSON. Then it has to transform it into HTML DOM nodes. Finally, it can inject them into the DOM. - If the server is responding with a bespoke non-JSON data structure, it's the same situation as above except even more work because a third-party, non-standard library has to decode this structure into something (most likely JSON) and then transform the JSON into HTML nodes, etc. etc. - If the server is responding with straight-up HTML, the client uses the browser's HTML parser to directly transform it into HTML nodes and inject it into the page. And by the way, the browser engine is essentially a function that is highly optimized for exactly this use case–parsing bytes into DOM nodes. 'We' might use the same API but it's widely accepted that generally the same API doesn't work for all contexts. See https://samnewman.io/patterns/architectural/bff/#general https://samnewman.io/patterns/architectural/bff/#general which details the many well-known problems with having a single API for different contexts.
- deadbabe 17d agoFortunately for the client, it costs them basically nothing to pay.
- vercelsucks 19d agoHopefully Vercel acquires them and puts the final nail in the coffin of that piece of shit PaaS and the SSR concept in general for client-side applications.
- SomeHacker44 18d agoShame the page does not tell you what HTMX is, even in one sentence.
- yawaramin 18d agoThe explanation is a single, obvious click away.
- Xeoncross 18d agoHtmx 4.0 is over 100kb / 2,000 lines of code. Isn't there a way to slim this down some? I mean, isn't the basic idea just a couple lines of code? I remember AJAX 2.0 or whatever loaders that were only 1-5kb wrappers around XHR back in the day. Now we have fetch() which is even more basic: fetch('/my/api/content.html') .then(response => response.text()) .then(html => { document.getElementById('content').innerHTML = html; }); I don't mean to imply this is close to total number of Htmx features, but fetching islands of content is the core idea and I feel like we're way past feature bloat at this point for something that is supposed to be simpler than React (Preact is only 10kB)
- moebrowne 18d agoWhere are you getting those numbers from? The minified code is about 40kB before compression and about 13kB with gzip. https://bundlephobia.com/package/htmx.org@4.0.0 https://bundlephobia.com/package/htmx.org@4.0.0
- Xeoncross 18d ago103KB is the actual source code. You should not be reading or debugging the minimized or gzip/transport bytes.
- yawaramin 17d agoYeah but when you're reading the actual source code you're not thinking in terms of bytes, you're looking and files and line counts. Htmx is deliberately maintained as a single, no-dependency file of about 5000loc. The maintainers are of the opinion that it reduces complexity, and I tend to agree.
- recursivedoubts 18d agoyou can check out fixi if you want to see a minimalist take on it: https://github.com/bigskysoftware/fixi/blob/master/fixi.js https://github.com/bigskysoftware/fixi/blob/master/fixi.js
- nektro 18d agofantastic library. htmx has completely changed the way i think about the web in the past year or so
- jordiburgos 17d agoI still do not get the point of Htmx of doing the templating in the server side. Maybe it is just me. Can anybody explain it better why mixing templates in the backed and HTML in the frontend opposite to keep all the HTML + templates in the browser and only return JSON from the server.
- mkrd 17d agoWhen sending json data, the browser has to run javascript to parse incoming data, keep track of it, and assemble the UI based on that data. One of the hardest parts of webdev is to synchronize server and frontend state, so there is a lot of things that can go wrong here, you are essentially maintaining the same state in two locations. With htmx, there is no frontend state. The html always just reflects the state of the server passively, meaning it cannot go out of sync. When you do something on the frontend and submit some request, the server will update its state and replace the frontend html to reflect that exactly. Here is an example. Traditional react app: Submit new todo item, append to some reactive js list, update frontend list, send new item to server. Here, you have to ensure that both sides did exactly the same thing, and if either side errors, you have to backtrack. Htmx app: Submit new todo item, send request to server, server stores it into its database, renders new list based on new database state, client replaces the list. Here, the server has the complete authority, and the frontend merely reflects that. If something fails, the server returns the old list plus an error. This is a tradeoff in efficiency, but the hope is that eliminating frontend state management is worth it.