9 ms·
Mesh: I tried Htmx, then ditched it
- worthless-trash 1y agoI heard there's a cup for ppl who hate htmx. Also, i don't see much htmx in the post, but what do I know.
- giancarlostoro 1y agoThe hot one for me right now is C#'s Blazor, which is not too young, bout 8 years now? Basically you can either have it do all the back-end dynamic rendering with C# for your front-end (Server Blazor) or you can compile it to Web Assembly. I have not written any JS in over a year, and the UI is very similar to how Razor pages are made. I'm of the opinion that this is the future of web development for numerous web frameworks should they invest in tech similar to Blazor. Phoenix's LiveView also comes to mind. I am hoping a brave soul builds something for Django (I've been meaning to try, but I have too many side projects going on atm) that is similar to Blazor.
- DonnyV 1y agoBlazor will die like Sliverlight. Just learn HTML, CSS and Javascript.
- codr7 1y agoYeah, I'm very wary about putting all my eggs in Microsoft's basket after what I've seen. They have a pretty extensive history of encouraging everyone to get on the wagon only to drive it straight into the nearest ditch. You can't trust a company that competes with its own customers.
- giancarlostoro 1y agoI know all three, and I'm not seeing it dying any time soon. WebAssembly is not going anywhere, neither are dynamic back-end systems. I have drastically less issues with my front-end while using Blazor compared to just doing raw JavaScript. I've built everything from a PWA from scratch using Vanilla JS, to an iFrame Frenzy web app a client paid us top dollar to build. Silverlight was proprietary, Blazor is MIT licensed and using open web technologies that are NOT going anywhere any time soon. We just had another major upgrade to Web Assembly's spec not that long ago.
- mystifyingpoi 1y agoSo what? It is just another tool in the toolbox. A tool that someone already invested in webdev can pick up in a week or two.
- codr7 1y agoTried Blazor, but found it too complicated and heavy for my needs. I've had more success with Phoenix/LiveView.
- sieep 1y agoBlazor at work to keep the lights on, Phoenix at home to keep my sanity :D
- bilekas 1y agoWhy anyone would choose to use the Razor syntax at any time is beyond me, let alone for the web. There is no need to make it so complicated, HTML is interpreted. As the article says : > HTMX leaves it up to the developer to impose discipline on their code, however they see fit. He said that like it's a bad thing. I really dislike those frameworks like Angular for example who simply say "You need to do it the Angular way". That just slows down innovation or clever ideas that solve little problems. Instead if there is a slow framework (looking at some peoples react implementations, Cloudflare recently [0]) Well you probably wont consider it or just see it as a "quirk" of the framework. [0] https://blog.cloudflare.com/deep-dive-into-cloudflares-sept-12-dashboard-and-api-outage/ https://blog.cloudflare.com/deep-dive-into-cloudflares-sept-...
- giancarlostoro 1y agoThere is no "blazor" way as far as I can tell, we've been rewriting our logic and structure since when everyone started on this project nobody knew how to structure Blazor, moving forward we are following best practices from React projects to an extent in order to better organize and keep components tidier.
- alex-moon 1y agoDefinitely - I think what's really interesting is that there is clearly a kind of "attractor" which all of these frameworks are pulled toward. That's kind of mainly what I was trying to aim at with the blog post - MESH isn't a solution at all, it's more I built it to show why it would go that way, i.e. the same way LiveView etc. and of course Blazor went. My question is: is there a form of this that could be merged back into the HTML spec itself and supported by the browsers? My gut says there isn't, by the way.
- giancarlostoro 1y agoYeah I wasn't trying to take away from what you wrote, just sharing my experience with a different framework. :) Please, use and work with what keeps you productive!
- jzig 1y agoAlex where on god's green earth is your scroll bar?
- yxhuvud 1y agoThere are definitely some parts that are common between these that it could be nice to propagate to the standard. https://alexanderpetros.com/triptych/ https://alexanderpetros.com/triptych/ lists some of them but I'm not certain how specific to htmx it is or how much it apply to the different variants.
- sieep 1y agoBlazor and Phoenix both seem the most intuitive for me also, especially when building complex frontends that require a lot of business logic. Being able to ditch the JS for that kind of work is amazing.
- malnourish 1y agoI've made some toys with Blazor; my teams are using Vaadin at a Java shop, now. Not exactly the same implementation, but a similar idea: express front end code using the backend language.
- elcritch 1y agoAt one company we had a contractor come in say I can totally build a simple IoT dashboard with a few buttons and wanted to use Blazor. I used Phoenix LiveView, on rpi3’s and later rpi4’s just fine. So Blazor sounded similar and figured it’d be fine. However Blazor just totally tanked the RPi that had 4gb of ram. It took minutes to load a web page when it did load. Of course that was years ago. Hopefully Blazor got better. Given that starting point I’d doubt it’ll ever match Elixir LiveView in efficiency. IMHO, other systems will to struggle to replicate Elixir’s LiveView due to BEAMs design using preemptive actors. It’s not impossible, just that’d it’d take a lot of work to match the responsiveness and resource usage. Currently I’m using Nim on backend and front end using a Karax SPA. It’s pretty nice sharing the same code on front end and backend!
- giancarlostoro 1y ago> However Blazor just totally tanked the RPi that had 4gb of ram. It took minutes to load a web page when it did load. Sounds like Blazor Server, if WASM was used, that shouldn't have been the case. I'm not very surprised considering how insanely efficient the BEAM is with memory.
- endemic 1y agoAt a previous job they were moving away from Blazor (which bummed me out, I love the philosophy) because every time they deployed it broke sessions/disconnected all active users.
- giancarlostoro 1y agoSounds like Blazor Server limitations.
- zwnow 1y agoI am torn about SSR. I see the advantages but I hate the workflow so so much... Also tightly coupling the views to your backend is something I really hate. I want to stay flexible, a completely independent frontend and a completely independent backend. I tried Phoenix for about 7 months this year and ultimately quit due to it feeling clunky and unintuitive, same with Livewire or any other SSR templating solution I've found. If there's SSR templating that is actually enjoyable to work with (from a DX perspective), I'd happily try it. Sadly nothing feels as good as just building web components.
- giancarlostoro 1y agoWe write only front-end logic on our Blazor components now, and use services to glue the front-end to the back-end which is the recommended way is my understanding. It's really nice, especially when you pull in something similar to MudBlazor.
- infamia 1y agoTry Datastar, it leans into web components, and they're working on a plug-in that integrates web components with Datastar. For example, I believe the star field on the front page of it's site is a web component. https://data-star.dev/ https://data-star.dev/
- pjmlp 1y agoWhich is kind of return to WebForms, GWT and JSF ways of working, only the implementation is a bit different than on the 2000's. We moved into MVC approach, because of the headaches that it used to be having to debug all the generated stuff from what the browser actually supports as built-in technology. I don't see that bright future for Blazor, other than a few .NET shops that don't want to learn native browser technology.
- giancarlostoro 1y agoThe debugging experience and the lack of context shift when going from thinking about how C# works to JavaScript (and all its zillion quirks!) is insanely better. I can put a breakpoint for the front-end and debug it just fine withing VS. I do wish Microsoft would finally open source their debugger, since I've heard loads of complaints about it being proprietary still.
- pjmlp 1y agoWith VS, and it still doesn't do anything when it is something broken at the browser level, CSS, HTML, JavaScript, that the VS debugger provides zero information, just like with WebForms.
- giancarlostoro 1y agoI'm not sure I've run into such a state yet, are you using Blazor without any UI component libraries? I am using MUDBlazor, genuinely curious what you're running into.
- pjmlp 1y agoI used it enough to understand how it works, compare it with my WebForms, GWT and JSF experience since their early days in 2001 onwards, and decide to stick with MVC, and browser native stack. Additionally, our agency is polyglot, and in no way frontend teams are going to start doing Blazor instead of their favourite framework of the month.
- 1y ago
- pier25 1y ago> I'm of the opinion that this is the future of web development Maybe but not with C#. Rust is a much better language for compiling to WASM. Leptos achieves something similar to Blazor with a fraction of the CPU and bytes. https://leptos.dev/ https://leptos.dev/ Blazor is much slower client-side than even the worse JS solution. Scroll to the right to see it compares: https://krausest.github.io/js-framework-benchmark/current.html https://krausest.github.io/js-framework-benchmark/current.ht... I would love to be able to handle all my web stack with C# but unfortunately the WASM bundles are too heavy for most use cases. Plus the DX for frontend is not even as good as it was with JS and Webpack like a decade ago. And these days the bar is much higher with Vite.
- bangaladore 1y ago> I would love to be able to handle all my web stack with C# but unfortunately the WASM bundles are too heavy for most use cases. This strikes me as a premature optimization. Most use cases? I'm interested if you have any examples. > Rust is a much better language for compiling to WASM. Why's that?
- OtomotO 1y agoBecause Rust doesn't need a GC
- bangaladore 1y agohttps://developer.chrome.com/blog/wasmgc/ https://developer.chrome.com/blog/wasmgc/
- viraptor 1y agoBecause rust actually compiles the code to native binaries. C# kind of started doing it some time ago, but AOT still has various limitations and edge cases. Blazor doesn't even compile your code into wasm - it ships the whole dotnet runtime as wasm and runs your app as bytecode. This means massive downloads regardless how simple your code is. There's relatively recent AOT for Blazor, but even that has to ship all the managed DLLs and part of runtime for the runtime reflection / metadata support.
- klysm 1y agoBlazor is fucking terrible. In principle it works in some use cases, the the library is designed horribly and it's very difficult to implement well behaved components. It's like a half-baked react 10 implementation.
- troupo 1y agoBlazor suffers from needing to lift the entire .net runtime into wasm. So first you download a gazillion resources that reimplement .net core/runtime/memory/garbage collector/whatever into the page. An eternity later your hello world can finally run. Though they did manage to really shave the runtime off somehow. It used to load megabytes and megabytes of data. > numerous web frameworks should they invest in tech similar to Blazor. Phoenix's LiveView also comes to mind. Phoenix live view sends minimal diffs that get applied to the DOM. It doesn't have "components that run in the client and on the server". Everything is done on the server, with very specific extension points into JS
- darthrupert 1y ago[flagged]
- nicr_22 1y agoInteresting direction, thanks for sharing. If you're interested in this space it's worth looking at data-star.dev. who takes hypermedia in the opposite direction - one endpoint per page, then push updates to components over SSE. My worry with MESH is that many endpoints might become a (sorry) mess...
- leobg 1y agoClickable: https://data-star.dev/ https://data-star.dev/
- alex-moon 1y agoI remember seeing this on the HN front page a while back! I subsequently forgot all about it, of course. Helps to see it again a second time, especially with the new context - I might give it a try next, see how I go. Thanks for the reminder!
- andersmurphy 1y agoIt does require a mind shift as generally you have one connection morphing in all your updates and do CQRS. The connection per component model that mesh uses is fine until you have concerns that cross across components (this was an issue hotwire also ran into before they introduced morph/refresh). Instead you have one endpoint per page re-render the whole page via morph on every change. You still have backend components they just send requests up and get their updates via the sse connection for that page. Kinda like view = f (state) just over the network.
- hamonrye 1y agothere is vulgarity to r3 lab's sse protocol, which mozilla's documentation for closing event streams goes over. [1]:https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#error_handling https://developer.mozilla.org/en-US/docs/Web/API/Server-sent...
- deadbabe 1y agoIs HTMX an antimeme?
- grimgrin 1y agoalex, this is a "Show HN" really, just fyi
- alex-moon 1y agoAh, possibly - the way I think about Show HN is it's for links to a codebase or demo app. There is a demo app linked in this article but it's not the link posted to HN. The Guidelines explicitly mention "blog posts" as not Show HN - https://news.ycombinator.com/showhn.html https://news.ycombinator.com/showhn.html - but they also say that's because they "can't be tried out". Grey area? Happy to do whatever precedent suggests.
- grimgrin 1y agoyeah my bad i dont know the rules or what i'm talking about but looking at your blog post i just thought "oh, they're showing us mesh", probably you're correct here though
- alex-moon 1y agoCool! I'm also not 100% sure, have only done a handful of posts. I would definitely put "Show HN" on a link to the demo app or the Github repo - and wait for the mods to correct me :D
- DonnyV 1y agoCongratulations, you have recreated NodeJS but with GO and HTMX.
- debo_ 1y ago> With this little helper, I can now start building out a very simple Trello clone to prove the concept. It's probably worth reading hypermedia.systems before using htmx. The book itself says that for more interactive components, you should go ahead and use JavaScript and whatever interactive framework you want to use on top of that. I use htmx with Django when: - I want to have some assurance that I will only have to minimally upgrade dependencies over the next few years - I'm doing something bog-standard (dashboard / admin UI)
- BoredPositron 1y agoWhy is it that people critizing HTMX always end up slapping abstractions on top of it. It always feels like they are missing the point why htmx is endearing for some of us.
- an0malous 1y agoMaybe the causality goes the other way: once you need to do something more complex than the basics, HTMX doesn’t work that well anymore
- miningape 1y agoThis has been my experience, the reality is HTMX doesn't scale well in terms of complex ideas / code. Great if you have something simple to achieve, not so great for a massive ongoing project. In other words: It has a steeper complexity gradient, albeit with a lower complexity floor.
- hirvi74 1y agoThough, for me, that begs the question: why not just use vanilla Javascript's .fetch()? One gets more flexibility than HTMX could ever provide, and the same logic is really not that many more lines to type.
- dpc_01234 1y ago99% of websites are, or should be, just a simple document(s) with a couple of forms, and the goal of HTMX is to help achieving low to medium complexity interactivity, and better UX on such sites easy. These are not the flashiest and most sexy demos, but the staple of the Internet. If you really need to make a web _application_ with lots of reactive interdependent elements, HTMX is not the tool for the job.
- troupo 1y agoHTMX is 14 kb of Javascript and additional complexity on the backend. At this point you're better off using something like SolidStart
- ezekiel68 1y agoI'm conflicted about this post. On the one hand, it's encouraging and cheerful. On the other hand, it pretends to evaluate HTMX by insisting on conventions which... have nothing to do with HTMX. Spoiler: HTMX does not deliver under artificial constraints.
- endymion-light 1y agoAs someone that dabbles in stuff, I found htmx to be amazing up to the point where I need to find out why a specific logic loop isn't working, or need to do something that's slightly off-piste. Which is to say it's incredibly useful for simpler websites but difficult for anything past 1000 lines. but i may just be using it wrong!
- djeastm 1y agoI had a similar experience. There was a point where my expectations became greater than my skill. Whatever simplicity I started with, I kept wanting more interactivity. I kept having to ask myself, "ok, now am I going to implement THAT in HTMX?" and I'd figure out some clever solution that worked... but only just. I also could never quickly refactor or move things around without a headache. Skill issue, possibly... So I ended up rewriting in React, which overall has been just better to meet the ever increasing interactivity requirements of my site and also my preferred workflow.
- mixmastamyk 1y agoNothing is stopping one from adding a bit of javascript when needed. Or complimenting with something like alpine or jquery.
- CooCooCaCha 1y agoThis is why I never understood htmx. Vanilla react is pretty easy to get started with, you just create a root component and mount it to a DOM element. Maybe 10 lines of code. Then you can go as simple or as complex as you want without having to awkwardly rig it up to another UI system.
- mixmastamyk 1y agoHtmx (re)uses html and doesn’t require learning a new paradigm or loading heavyweight libs.
- deleted 1y ago[deleted]
- recursivedoubts 1y agoSounds like this app wasn't a good fit for htmx. I have added it to the "On The Other Hand" section on the htmx website: https://htmx.org/essays/#on-the-other-hand https://htmx.org/essays/#on-the-other-hand Regarding the default swap behavior of "innerHTML": https://htmx.org/quirks/#the-default-swap-strategy-is-innerhtml https://htmx.org/quirks/#the-default-swap-strategy-is-innerh... Our proposal to merge htmx functionality into the HTML spec uses outerHTML: https://alexanderpetros.com/triptych/ https://alexanderpetros.com/triptych/ Also consider datastar, it was written from an SSE-first perspective by a go engineer: https://data-star.dev/ https://data-star.dev/
- pabe 1y agoIf only more people were like you <3
- alex-moon 1y agoOh wow! This is a huge honour, thank you so much! I definitely started writing a "lol HTMX is shit" post, but it just wasn't honest. HTMX is incredibly powerful - I am a fan of what you all have done with it. This attempt on my part to try and write something server-side rendered wouldn't have happened without the kick up the butt HTMX gives me (and all of us).
- recursivedoubts 1y agoNo problem at all. There are aspects of htmx that are good and bad depending on context and experience, and I like having different perspectives on it available for people to read, so thank you for taking the time to put together an in depth essay on it.
- stronglikedan 1y agoI can't help but to think "lol HTMX is shit" may have beat out "htmx sucks" for first place on that list!
- bccdee 1y agoYeah, in my (limited) experience, htmx works best to grease the wheels of an oldschool multi-page app. I tried building something with SPAish drag-and-drop interactivity using htmx, and my ultimate conclusion was that functionality like that should either be totally encapsulated as one big htmx swap unit or be written as js "islands" outside htmx.
- ahallock 1y agoWhile these technologies are interesting, React has built a moat with its component ecosystem. It doesn't matter how intuitive or simple your new frontend solution is when I can `bunx add` a component from shadcn/ui and be instantly productive. Not to mention most companies with frontend integrations are shipping their own React components. You get composability and familiarity. And while there are decent component libraries in plain JS, the top talent is building in React.
- andy800 1y ago"top talent" lol
- unit149 1y ago[dead]
- causal 1y agoI like that people are experimenting with HTMX, so please keep it up. But I don't think MESH is one I would pick up for my projects: - For complex apps, I love JSX for its ability to distill complexity into simple, discrete components. - For simple apps, I love HTMX ability to make plain the relationship between raw HTML and API response. In the MESH examples I see a lot of verbose code that doesn't seem to achieve the simplicity of JSX nor the transparency of HTMX. That said, I certainly don't grok MESH yet so perhaps in a project it would click for me.
- gwd 1y agoI feel like this would have been a bit better with some sort of "recap" at the end, to summarize where he got to. The README on the MESH page is a good summary: > MESH is a fun project intending to demonstrate the kinds of concepts embodied by HTMX - without using HTMX. Specifically, we're rendering modular elements on the server, and hydrating them on the client, swapping them out as needed instead of reloading the whole page. Component updates are swapped in place. Out-of-band updates are sent to all connected clients via SSE (server-side events), meaning all users see updates in real time. (To expand that for people not familiar with HTMX's out-of-band updates: Basically, in MESH, on the client you hook up something listening to updates sent from the server via SSE. What the server sends are basically snippets of HTML with an ID in them; the listener on the client replaces the HTML in the DOM with that ID with the HTML sent over the wire. This allows the server to arbitrarily update the client's UI.) So it shares one of the mechanisms of HTMX, which is to do SSR with the ability to replace individual elements.
- fijiaarone 1y agoThe concept of MESH sits somewhere between course grain components and server islands. React is for fine grain components and HTMX is for lightweight interactivity — update part of a page. The classic React use case is an editable, filterable drop down. The classic HTMX use case is click a button and load some text. The overlap comes in the middle, with a simple form validation. React says make each field a component that handles its own validation and error messages. HTMX says just return a re-rendered form with the error messages. MESH says make the form a component with its own endpoint.
- gwd 1y ago> HTMX says just return a re-rendered form with the error messages. MESH says make the form a component with its own endpoint. HTMX can do the same thing: you can do `hx-trigger="changed delay:500ms"`, and make an endpoint for that component that will do validation, update an error message status area (adding or removing an error as appropriate), and even potentially enable / disable the "submit" button. It seems to me that the main difference in approach is whether the "source of truth" for the state of the page is on the client or the server. HTMX is designed to be flexible (which is one of TFA's complaints actually), but its primary vision is HATEOAS (Hypertext as the Engine of Application State); which to my understanding of reading HTMX's documentation, is meant to mean that everything important about the client state should be kept on the client; the server should be able to be entirely reactive. What I see skimming through MESH (and data-star.dev) is that the "source of truth" is on the server. Not an authority in this area, so happy to be corrected on all those points. But I am in the middle of building a dynamic query form using HTMX, trying to design it with HATEOAS principles, so it is something fresh in my mind at any rate.
- andrewstuart 1y agoAfter being a React true believer I ditched it recently. I tried to go pure JavaScript but ended up with web components with lit and really could not be happier.
- progmetaldev 1y agoI have been using the Umbraco CMS since 2013, and they moved from AngularJS 1.x to Lit for the backend technology. While it was frustrating at first, due to a lack of documentation around the specific CMS APIs, I can see that it was a great choice to move towards a more "standard" technology that is somewhat agnostic of a full library. Working with web components makes so much more sense to me than the way AngularJS works, as well as the React and Vue tutorials I've followed. If I found a killer feature implemented in React or Vue, I could still make use of my Lit web components without having to toss out everything and rebuild.
- recursivedoubts 1y agoOne other comment, if you want to experiment w/different behaviors and defaults around the general concept of htmx (generalized hypemedia controls in HTML) you can fork fixi.js which is 89 lines of code (and uses `outerHTML` as the default swap strategy): https://github.com/bigskysoftware/fixi/blob/master/fixi.js https://github.com/bigskysoftware/fixi/blob/master/fixi.js i created it as an experiment in minimalism: https://github.com/bigskysoftware/fixi#-fixijs---it-aint-much https://github.com/bigskysoftware/fixi#-fixijs---it-aint-muc...
- dkyc 1y agoFrom "framework fatigue" to "new framework" in five paragraphs. Personally, I find all these minimalist, back-to-the-basics frameworks a bit misguided. It's always reeks a bit of "well my farts don't smell" – other developers' frameworks are bloated, dependency-overloaded and too complex. My new framework is simple, based on a powerful idea, and just right. Imo, the best way to build a truly good web app in 2025 is to embrace both server-side rendering and client-side rendering, by sharing the same rendering logic between client and server, like e.g. SvelteKit, Next.js and others do.
- wry_discontent 1y agoUsing Next.js is malpractice. I've never had a worse experience with a web framework (and I'm using that word extremely loosely here).
- skydhash 1y agoI’m ready to bet that anyone that chose Next is now battling a ball of mud and a buggy one with that.
- wry_discontent 1y agoWe had a nontechnical person choose Next, against my recommendation but I didn't have the authority to override that choice, and it's been a total nightmare. It's extremely messy. Hostile to debugging. Hostile to testing. Bad HMR. All this to offer us RPC and filesystem based routing (neither of which I even want in a framework).
- srcreigh 1y agoMy favourite SSR framework is built in to React. It's called `renderToString`
- ramon156 1y agoNo, fameworks are relatively opinionated towards the goal the creator had, which is usually in a README. They're all tools that need more context to decide on when you use them. For example, in my use case (SaaS) I focus on something that makes refactoring a breeze. Type-safe end-to-end is important there, so I use orpc+react for most projects. If you don't like contract-first APIs you're going to hate this, but it makes me think out what I actually want in my frontend before I write the database. This kind of [mocking -> real data] way of coding makes you proactive when designing the app
- replwoacause 1y agoI prefer the approach of EHTML: https://e-html.org/ https://e-html.org/
- JodieBenitez 1y agoStrange post. It feels like trying to carve a piece of wood with an iron. Cool hack, I guess... this is hacker news after all.
- 827a 1y agoIn a similar vein, I consumed some content from DHH talking about how 37Signals went no-build for Hey or something, then figured I'd play with that idea for a bit and see what its like developing a no-build site. The immediate problem I hit was that tailwind essentially requires a build; at the most basic level because you don't want to bundle properties that your app isn't using, but at a more sophisticated level, because properties like `md:flex` or `max-w-[100px]` intrinsically demand some amount of dynamism in their generation. I played around with re-creating a functional no-build subset of tailwind, but it quickly hit many-many dozens of kilobytes while being unable to cover even a small subset of Tailwind's capability. So, no tailwind, which I feel is a major loss in productivity. I didn't end up pursuing the dream further; a hyper-minimal vite app, even just using basic HTML & CSS, feels to me a very small price to pay given all the benefits it carries.
- troupo 1y ago> The immediate problem I hit was that tailwind essentially requires a build; 1. If you don't want to build something, you don't need Tailwind. https://every-layout.dev/ https://every-layout.dev/ will get you very far (well, it will get you very far regardless of what you use for CSS) 2. "No build" is a mantra and a cult. There's nothing bad about building your final app. The problem is that the web made it extremely complex.
- halfcat 1y agoI’ve use Tailwind standalone CLI with non-node projects (Django, etc) and it’s always worked well.
- 827a 1y agoBut: Using the Tailwind standalone CLI is a build step. Which means you're no longer no-build.
- yawaramin 1y agoBulma doesn't require a build, and works quite well.
- 1y ago
- xg15 1y ago> MESH is based on a simple principle: one component = one endpoint. This is a powerful idea - it allows us to write a HTML-first back-end in such a way that it feels like writing an SPA. Gotta admit, I'm still not completely grasping the hype around HTMX, but I thought one of the core ideas was that it decidedly should not feel like writing an SPA, but more like old-style PHP or ASP scripts again. (In the sense that the front end is driven by the back end instead of the other way around) So wouldn't this give you sort of the worst of both worlds? The modeling overhead of SPAs + the tight coupling of HTMX?
- treve 1y agoYeah this also reminds me of people getting burned by Web Components, because they use them with the same granularity as React components.
- troupo 1y agoBecause that's literally how they were marketed and hyped for a very long time. Now? No one knows or can tell you what they are for (except leaf components and HTML Web Components maybe)
- rtpg 1y agoare they supposed to be more or less granular?
- paulddraper 1y agoLess granular. Somewhere between "React components" and "Microfrontends." They can still be small, but often you will want many fewer than React components.
- nsonha 1y agoanything can be granular, but doing that in web component is very clunky, it's like writing java with a class and a code file for every tiny thing.
- troupo 1y ago
- deleted 1y ago[deleted]
- latent22 1y agoHey alex-moon one feature you had issues was that HTMX does not process server generated shadow DOM content because it uses the standard old DOM parser. Next point release should have https://github.com/bigskysoftware/htmx/pull/3185 https://github.com/bigskysoftware/htmx/pull/3185 merged hopefully which will allow the use of Document.parseHTMLUnsafe() which is the modern browser replacement that does support this use case but it might go behind a new config flag.
- latent22 1y agothen you may be able to do things like this I think <mesh-card id="card-123" hx-swap-oob="true"> <template shadowrootmode="open"> <link rel="stylesheet" href="/static/css/components/card.css" /> <div class="card"> <div class="card-header"> <h3>Updated Card Title</h3> </div> <div class="card-content"> Updated card description here. </div> <div class="actions"> <button type="button">Edit</button> </div> </div> </template> </mesh-card> class MeshCard extends HTMLElement { connectedCallback() { if (!this.shadowRoot) { const tmpl = this.querySelector('template[shadowrootmode="open"]'); if (tmpl) { this.attachShadow({mode: 'open'}) .appendChild(tmpl.content.cloneNode(true)); } } } } customElements.define('mesh-card', MeshCard);
- deleted 1y ago[deleted]
- lo_fye 1y ago>> it allows us to write an HTML-first back-end in such a way that it feels like writing an SPA. I think you’ll find that most people who love HTMX don’t ever want something that feels like writing an SPA.
- mleonhard 1y agoYes. With HTMX, one can put a page definition and its endpoints in one file. It has high cohesion. There's no integration with routers, state stores, or rpc handlers. There are no DTOs shared between the frontend and backend. It has low coupling. High cohesion and low coupling bring benefits in engineering productivity.
- pylotlight 1y agoIs the alpine + htmx dynamic for appropriately handling interactive pages not suitable for many use cases?
- kennywinker 1y agoAlpinejs is my go-to for small stuff. Probably wouldn’t want to write something gigantic with it, but it can be broken into components pretty nicely so maybe that hesitation is wrong.
- vlad1719 1y ago[dead]
- mleonhard 1y agoHow does one handle errors with MESH? To handle errors in HTMX, I like to use config from [0] to swap responses into error dialogs and `hx-on-htmx-send-error` [1] and `hx-on-htmx-response-error` [2] to show the dialogs. For some components, I also use an `on-htmx-error` attribute handler: // https://htmx.org/events/ document.body.addEventListener('htmx:error', function (event: any) { const elt = event.detail.elt as HTMLElement const handlerString = elt.getAttribute('on-htmx-error') console.log('htmx:error evt.detail.elt.id=' + elt.getAttribute('id') + ' handler=' + handlerString) if (handlerString) { eval(handlerString) } }); This gives very good UX on network and server errors. [0]: https://htmx.org/quirks/#by-default-4xx-5xx-responses-do-not-swap https://htmx.org/quirks/#by-default-4xx-5xx-responses-do-not... [1]: https://htmx.org/events/#htmx:sendError https://htmx.org/events/#htmx:sendError [2]: https://htmx.org/events/#htmx:responseError https://htmx.org/events/#htmx:responseError
- AfterHIA 1y agoThis might be tangentially but as a 90's/2000's brat I've always been confounded by the old maxim, "HTML is for markup not presentation" and sure but if that was true why are there clearly a bunch of tags which don't meaningfully markup anything except to tell the browser to display the text some way? I'm thinking, "<i>", or, "<b>." Your average person building a webpage early on wasn't concerned about markup. I've never met anyone that isn't a LaTeX user or software developer that cared about markup. We cared about how the page would look and how it behaved (how it was, "animated.") Fundamentally there's a lack of appreciation for, "web design as a painterly exercise" and that to me creates the crisis. The humane discipline of designing a webpage is in most respects divorced from the act of coding a website. It's fundamentally a question of ethics and aesthetics; of, "whys."
- badbotty 1y agoThese elements have non-presentational definitions in the current spec. A screen reader could make use of the semantic difference between <strong> and <b>, even though desktop browsers default to presenting them the same way. https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-i-element https://html.spec.whatwg.org/multipage/text-level-semantics....
- geenat 1y agoFeels like an LLM designed system. IMHO this is already over-engineered as the frameworks being critisised; no simplification happening here.