7 ms·
I recently started using htmx (https://htmx.org/ https://htmx.org/) in combination with Django and have become a firm believer of sending HTML 'over the wire' i
by michaelanckaert 5y ago
I recently started using htmx (https://htmx.org/ https://htmx.org/) in combination with Django and have become a firm believer of sending HTML 'over the wire' instead of JSON structures that then get used client side.
- dzonga 5y agoyep and thanks to /u/recursivedoubts for delivering an excellent package. I use htmx then mithril for those pages that really need client side interactivity. and it's refreshing.
- SPBS 5y agoFrom https://htmx.org/ https://htmx.org/: > Why should only <a> and <form> be able to make HTTP requests? > Why should only click & submit events trigger them? > Why should only GET & POST be available? > Why should you only be able to replace the entire screen? I love their motivation points, but do you really need 11kb of gzipped js to do this? At that point it's almost like a frontend library itself (mithriljs is only 9.5kb gzipped).
- recursivedoubts 5y agoYou can tear out some of the stuff (sse support, web sockets) and shrink it ~2k. Do away with the events mechanism and extension points, knock down the configuration options, drop IE support and probably get it down to around 6 or 7k. It could certainly be smaller, but to support things like CSS transitions and so forth it takes some code. I've tried to keep the power-to-weight ratio high by creating a rich events model and extensions mechanism to take pressure off the core library. My goal was to keep it under 10k, but I couldn't do it (I may pull SSE and WebSocket support out to try to tuck it under 10k again.) On the other hand, compare it with the average image on a website, and 11k isn't bad.
- guggle 5y agoLooks like what we used to do more than 15 years ago with taconite. I guess I'm now old enough to see history repeating in web development tools.
- syshum 5y agoI was having the same thoughts...
- michaelanckaert 5y agoI guess everything really is cyclical :)
- michaelanckaert 5y agoI'm curious if you can link me to more information on Taconite? I have been explore the techniques used by "HTML over the wire" and htmx and would like to delve deeper into older systems or technologies that were using these before.
- guggle 5y agohttp://malsup.com/jquery/taconite/ http://malsup.com/jquery/taconite/
- osrec 5y agoI personally prefer sending JSON or CSV over the wire, and keeping all presentation logic on the client side. This allows me to adjust the presentation layer based on what's best for each specific client. Why do you prefer to send HTML over the wire?
- danielheath 5y agoPerformance is the main one. Particularly on older android devices where script execution is absurdly slow, and network traffic is also often slow, pure HTML is a big win.
- michaelanckaert 5y agoI feel that it empowers me as a Backend developer and makes me productive on both the BE and the FE. For one it adds a simple set of primitives I need to learn on top of HTML (a basic tech to know), so no large JS frameworks or patterns to learn. Secondly, it's really fast with regards to development speed, application speed and just getting up to speed in general. A basic MVC framework (such as Django but others also) is all you need in addition to the primitives I talked about above. With modern frameworks such as Vue or React, I need a backend with basically the Model and Controller part and then a different framework for the View part.
- sbarre 5y agoIf you are confident that HTML will be your only target over time, then for sure this works. The challenge can come if/when your backend needs to start servicing a mobile app, or some other channel that doesn't use HTML. But again if you know that won't happen, no need to prematurely optimize for it.
- hazz99 5y agoWith webview based applications becoming more and more common, maybe HTML is all we’ll ever need.
- 5y ago
- qatanah 5y agoI'm loving htmx! as backend developer this just eliminates all the js monstrosity of packaging, dependencies and deployments..
- jakearmitage 5y agoHow would you do a data table with HTMX? Just send over the whole tbody?
- polyrand 5y agoHTMX (and HTML over the wire) is giving me some hope for frontend development. React / SPAs have their place and are great technologies, but 98% of the time they are not needed.