3 ms·
we do have a client-side template extension: https://htmx.org/extensions/client-side-templates/ https://htmx.org/extensions/client-side-templates/ however, I
by recursivedoubts 3y ago
we do have a client-side template extension:
https://htmx.org/extensions/client-side-templates/ https://htmx.org/extensions/client-side-templates/
however, I would encourage most folks to use HTML as the network format: it typically isn't much more CPU to generate the equivalent HTML string that corresponds to a JSON string (sometimes even less, as with tables)
for pure client-side, htmx is largely hands off. We support an `hx-on` attribute to address the fact that HTML doesn't support general `on*` attributes, but that's it
it does, however, emit a large number of events that you can hook into to extend things:
https://htmx.org/reference/#events https://htmx.org/reference/#events
And it plays well w/ scripting solutions like Alpine.js or, our our own scripting solution, _hyperscript: https://hyperscript.org https://hyperscript.org
- lcnPylGDnU4H9OF 3y agoAnother benefit of using HTML is ease of progressive enhancement. If the default behavior of the server is to render a full HTML page, anyone hitting that URL directly will get the full HTML from the server with no additional back-end work. Additionally, if JS is disabled in the browser, links still work as traditional links.
- pragma_x 3y agoThanks for the thoughtful reply, and the thoughtful architecture.