Recently, Rich Harris, creator of the Svelte framework, posted a video asking if single-page apps have ruined the web? In the video, Harris examines the pros and cons of both sides, ultimately determining that the way forward is to use a bit of both approaches — via what he calls “bridging apps,” which are a mix of technologies. SPA and MPA.
In a response to this video, Carson Gross, creator of htmx, argued that many of the specific examples that Harris offers as problematic for AMPs can actually be solved with htmx itself. Beyond offering htmx as a solution, however, Gross also asserts that there’s one big problem that Harris overlooked in his discussion of the drawbacks of SPAs: complexity.
What is htmx and why is it useful?
The complexity of front-end web development is something Gross has been trying to solve for almost a decade now, having created the alternative front-end library intercooler.js in 2013, which came with the tagline “AJAX with Attributes: There’s No doesn’t have to be complex”. Recently, intercooler.js hit version 2.0 and became htmx, which, according to the description from GithHub, “gives you access to AJAX, CSS transitions, WebSockets, and server-sent events directly in HTML, using attributes, so you can create modern user interfaces with the simplicity and power of hypertext”.
“The concept is to use the original model of the web to build web applications, but let’s make the HTML more powerful.”
– Carson Gross, creator of htmx
- Why alone and
- Why should only click & submit events fire them?
- Why should only GET & POST methods be available?
- Why should you only be able to replace the entire screen?
Make HTML more powerful
Gross sees htmx as an answer to this complexity for many websites – even sites like Facebook or Twitter, which are “mostly text and images”.
Photo by Paula Schmidt of Pexels.