←back to thread

Less Htmx Is More

(unplannedobsolescence.com)
169 points fanf2 | 1 comments | | HN request time: 0.2s | source
Show context
kolektiv ◴[] No.43620012[source]
It is amazing how quickly a simple, traditional, "collection of pages" type website actually works if you don't do annoying things to slow it down. Most websites would be absolutely fine if a) HTTP was used reasonably well to set things like cache headers, and so (as mentioned in the article) and b) if a load of user-irrelevant stuff like tracking and advertising code wasn't thrown in as well. A simple page with standard HTML, passably optimised assets where needed, and only the JS needed for actual functionality, should be almost instant on most modern connections.
replies(3): >>43620362 #>>43620363 #>>43620930 #
Manfred ◴[] No.43620362[source]
I believe some of these issues are caused by framework abstractions.

New developers learn the framework and never learn how HTTP and HTML work.

Experienced developers have to learn how to punch through the framework to get to these features we get automatically with statically hosted assets.

replies(4): >>43620425 #>>43620499 #>>43620782 #>>43622435 #
1. xiphias2 ◴[] No.43622435[source]
As you can see even the basic documentation is compromised at this point:

https://unplannedobsolescence.com/blog/behavior-belongs-in-h...

<button onclick="alert('I was clicked!')">Click me</button>

,,You can find HTML attribute equivalents for many of the event handler properties; however, you shouldn't use these — they are considered bad practice. It might seem easy to use an event handler attribute if you are doing something really quick, but they quickly become unmanageable and inefficient.''

,,You should never use the HTML event handler attributes — those are outdated, and using them is bad practice.''

And then proceeds to suggest this:

<button>Click me</button>

<script> const btn = document.querySelector("button")

btn.addEventListener("click", () => { alert('I was clicked!') }) </script>

After this, next step would be putting javascript to a separate file, and on a slow mobile connection in a random airport with thousands of people using the same wifi, a simple working code gets timeouts.

20 years ago all I needed to know was this, and it worked great:

<button onclick="alert('I was clicked!')">Click me</button>