3 ms·
The beauty of htmx is that it doesn't matter what you use on the backend. Literally anything that'll render HTML will suffice. Even static HTML files on a web
by acaloiar 3y ago
The beauty of htmx is that it doesn't matter what you use on the backend.
Literally anything that'll render HTML will suffice. Even static HTML files on a web server will do. No need for an application server at all if you're clever and your needs are simple.
- sureglymop 3y agoWhat if I want the website to work even when JavaScript is not turned on? I'd need a backend server and some frontend logic handling that case.
- iudqnolq 3y agoNot necessarily. It depends on what you need. For example suppose you were implementing an news reader with two panes. Left pane is a list of titles and previews, right pane is a full article for the selected item in the left pane. You can make the left pane a list of links to dedicated pages, and then add an htmx attribute to indicate that when the user has JavaScript to instead fetch a html snippet with just full article and swap it into the right pane. If you had a reasonably bounded set of articles you could statically generate all the /article/id.html and the /article/id/snippet.html files, though a backend probably makes sense.
- sureglymop 3y agoAt that point, how big is the difference really between sending the right pane only as opposed to the whole page performance wise? I'm just not sure if this approach is worth it for me.
- wishinghand 3y agoIn that case you need to have everything rendered server side and perhaps get creative with the usage of forms firing off events that can be intercepted by the server and then return a new page. Certain things like Nav menu drop downs and folding text can’t be done with native CSS and HTML.