5 ms·
I am the author of this article. Happy to answer questions. I know my alternative approach, htmx-enhanced hypermedia, isn't right for every application, but i
by recursivedoubts 4y ago
I am the author of this article. Happy to answer questions.
I know my alternative approach, htmx-enhanced hypermedia, isn't right for every application, but it can be a much simpler approach for many applications, and, since it is so simple, can be used to conserve complexity in applications that have parts that are not amenable to the hypermedia approach.
- encryptluks2 4y ago
- recursivedoubts 4y agoSPA means "Single Page Application", I don't spend much time defining it but defer to Tom Wright's definition, about which he says: > The SPA pattern (Single-Page Apps), I tried to define, was about the React model, which also covers, to a large extent, the model of Vue, Angular, and other frontend frameworks. I created an alternative to AngularJS, Meteor, Knockout and Ember.js back in 2013 called intercooler.js. It used hypermedia as the communication mechanism with the server, rather than JSON. I wrote the library in JavaScript because that's what was there. In 2020 I rewrote the library to eliminate the jQuery dependency and clean it up and renamed it to htmx, since I had figured out that it was a generalization of HTML as a hypertext. I think that's a pretty good summary of what happened.
- woojoo666 4y agoThis reads like more of an attack than a question. Even though I prefer React over HTMX, I think the difference is pretty clear, as well as the intention of this article. In particular, this quote from the article is most relevant > In HTML-Centric Development, rather than being an afterthought, HTML is embraced as the primary medium of application development. This is in contrast to most SPA frameworks, where a client-side model & the javascript that manipulates it is the central focus. If you read the authors other post about REST [1], they also talk about how most SPAs communicates with the server via JSON, whereas HTMX uses HTML. This is also part of the HTML centric design. You embed the fetching logic into the HTML, and the server returns HTML directly, so there's less work done on the client, in constrast to most SPA frameworks. [1]: https://htmx.org/essays/how-did-rest-come-to-mean-the-opposite-of-rest/ https://htmx.org/essays/how-did-rest-come-to-mean-the-opposi...
- encryptluks2 4y agoThe title is literally an SPA Alternative. Should the title then not be updated to an SPA framework, since it isn't an alternative. That is like saying Microsoft Word is an alternative to word processors.
- recursivedoubts 4y agoBut it isn't an SPA framework, it's a generalization of HTML as an alternative to SPA-style frameworks. It's very different conceptually, as different as mobile apps and web 1.0 apps at the network architecture level. I understand that this approach will not appeal to a lot of folks, but on the other hand that's because it is so different than what most of the industry is doing. I hope I understand your criticism correctly here.
- encryptluks2 4y agoThe issue I have is that you're taking the idea of an SPA, which is pretty loose: > An SPA (Single-page application) is a web app implementation that loads only a single web document, and then updates the body content of that single document via JavaScript APIs... Looking at the examples at htmx.org, this is exactly what it does. Just because some car manufacturers decide to put an engine in the front of the car doesn't mean that a car with an engine in the back isn't still a car.
- jaredcwhite 4y agoBut htmx doesn't update the body content of the document via JavaScript APIs. It updates them via HTML APIs. That is, the content coming over the wire from the backend is HTML, not JSON. If you're trying to claim that literally any web page which uses JavaScript in any capacity to update any DOM on the page ever suddenly means it's an SPA, that seems like _quite a stretch_.
- dragonwriter 4y ago
- pier25 4y agoTechnically correct but you will have to admit probably +90% of React apps are SPAs.
- encryptluks2 4y agoThe issue is the title which is incorrect.
- mtlynch 4y agoThanks for sharing and for your work on intercooler.js and htmx! I share your sentiments about SPAs, and I've been trying to get back to a simpler web stack. One of the hurdles I keep running into with libraries like htmx and Alpine is that they don't play nicely with Content Security Policy. And I'm reluctant to forfeit CSP to use a JS library since CSP is the most robust solution I've found for preventing XSS. Alpine is working on a CSP-compatible build, but it hasn't been released[0] and doesn't seem to be a priority. htmx is compatible with CSP, but it effectively reverses the protection it offers. The attacker can inject JS through htmx directives.[1] I know there's hx-disable, but this degrades CSP's effect from "secure by default" to "secure when the developer remembers to mark the subtree as containing user-controlled data." Is there a way to use htmx without forfeiting the benefits of CSP? [0] https://github.com/alpinejs/alpine/issues/237#issuecomment-999692410 https://github.com/alpinejs/alpine/issues/237#issuecomment-9... [1] https://htmx.org/docs/#security https://htmx.org/docs/#security
- recursivedoubts 4y agounfortunately not one I can think of without htmx being baked in to HTML which, I think should be the case: I don't think htmx should have to exist, I think this is just how HTML should work. That could address a lot of accessibility and progressive enhancment issues as well.
- mtlynch 4y agoAh, bummer. Thanks for your answer!
- BeefySwain 4y agoI have no idea how one would go about doing this, but I'm curious if you have pursued that option? Getting the functionality of HTMX into the HTML standard?
- aaaaaaaaata 4y ago+1
- 60secs 4y agoWhy the use of the article 'An' instead of 'A' ?
- detaro 4y agoBecause you use "An" if the following starts with a vowel sound, and "SPA" (spoken as the individual letters) does. (EDIT: fell for a false friend, fixed)
- tartoran 4y agoInteresting. Do you generally pronunce it as Es-pea-ay? In that case it warrants the an in front
- sirshmooey 4y agoMost wouldn’t read an acronym phonetically if it happens to spell a commonly used word.
- deleted 4y ago[deleted]
- detaro 4y agoFWIW, I've never heard anyone say "spa" for SPAs (including conference talks by native speakers, so not just local bubble).
- deleted 4y ago[deleted]
- zagrebian 4y agoCould you put publication dates below blog post titles on that website?