Can't recommend enough the Hypermedia Systems ebook to web developers. Not only a great resource for learning and "getting" #htmx, and acquiring key best practices for using it, but it also makes the case for the classic #hypermedia system architecture, which has been somewhat disregarded over the last decade or two. Should be a worthwhile read, regardless of the framework or app architecture you intend to use. https://hypermedia.systems/#webdev#html
Minor Kitten¹ update: Even if your page routes now return nothing (e.g., null, undefined, empty string), a proper page will be rendered that includes the development-time WebSocket that powers hot reloads.
A fifteen-second demo of how you can create a toast message in 42 lines of code¹ without writing any client-side JavaScript using Streaming HTML² in Kitten³.
Update: I forgot to make the toast message div into an aria-live region so toast messages are read out when they arrive for people who use screen readers.
Kitten update: session IDs now available in the request.session objects you get in your routes.
Kitten lets you persist arbitrary data in session objects to make it easy to work with sessions but you cannot store custom objects (instances of custom classes) as Kitten’s default database is not aware of custom classes in your application. Now, keyed to the session id, you can store custom objects in your app’s own database.
(The use case for this is pretty neat: keep your interface state in custom state class instances persisted in session objects and, using the Streaming HTML workflow*, send back pieces of the interface that take those state objects as their only prop. Quite a neat separation of concerns and state is maintained only on the server in those objects.)
If there was an #HTML element that changes it's content when users interact with other elements on the page, what name would it have?
PLEASE NOTE: I am not suggesting that this element needs to exist; I am only asking what it would be called. I'm building a CustomElement, I just want it to have a name that makes sense.
Vote and suggest others in replies. Please boost for reach!
An <HTML> element that updates with the result of an HTTP request that some other element on the page made.
Links and forms inside it may be changed so that they only update this element instead of the whole page; similarly to Hotwire: TurboFrames https://turbo.hotwired.dev/handbook/frames
「 This is a good thing: the industry should question REST-ful ideas in the Data API world and begin looking at older client-server technologies that did a better job of servicing that particular network architecture, leaving REST instead to the network architecture that it was coined to describe: hypermedia APIs 」
> Not being content with alienating only the general purpose #JSON#API enthusiasts, let me now proceed to also alienate my erstwhile #hypermedia enthusiast allies by saying:
> I don’t think #contentNegotiation is typically the right approach to returning both JSON and #HTML for most applications.
#Mintter#Hypermedia is an open system, built on #IPFS that allows communities to collaborate on content that is structured and deeply linked. All content in the system is cryptographically signed, versioned, and made permanent with IPFS.
My intuition tells me that #htmx's hx-swap attr will suffice for many dynamic #web behaviors but there's a point where the abstractions will start to leak and you'll want full control over #DOM again.