Top
Best
New

Posted by iNic 6 days ago

Please just try HTMX(pleasejusttryhtmx.com)
615 points | 507 commentspage 12
boredumb 6 days ago|
please, just use html/css and some javascript where applicable.
adamzwasserman 6 days ago||
Even if you do have complex client-side state: dataos.software
ndr 6 days ago||
If you never seen HTMX it is a small js library that lets you swap some part of your dom with the responses from your webserver.

This means that in theory you (as a dev) don't need (to write any) js, nor do your users need to download a full page (for any interaction) like it's 1999. Your webserver replies with fully server-renderd HTML but just for the dom node (say a div) that you want to replace.

It's fun for very simple things, even great for extremely simple interactions modes. For interactive products, anything beyond simple CRUDs, it's madness.

Whenever you want to sprinkle a tiny bit of interactivity you'll have to choose between the path of least resistance (a small hack on HTMX) or a proper way. State management gets out of control real fast, it's the opposite of UI=f(state).

I've seen it go bad, then worse with alpine-js, and then completely ripped in favor of something where people can let the browser do browser things.

[edit for clarity]

rkomorn 6 days ago||
> it is a small js library ... This means that in theory you don't need js

I assume I'm not the only person left a little puzzled.

Do you mean "don't need JS" as in like, a full-fledged JS framework?

ndr 6 days ago|||
See the quickstart from htmx.org

    <script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js"></script>
      <!-- have a button POST a click via AJAX -->
      <button hx-post="/clicked" hx-swap="outerHTML">
        Click Me
      </button>

When the user clicks the button the browser will take the result of the request to `/clicked` and swap the whole button dom node for whatever the server sent.

As a dev you get to write HTML, and need to learn about some new tag attributes.

Your browser is still running js.

lunar_mycroft 6 days ago||||
They mean that you don't need to write JS, you can just add a script tag to your page
chamomeal 6 days ago|||
Sorry I know other people have responded already, but it means you don't have to write any client side javascript at all. You can just skip along with a server that returns html. Just throw the script tag in there, and you're done.

The magic of this is that it's pretty easy to make SPA-like webapps with no javascript or complex client side framework. You can write your server in python, rust, clojure, whatever. If you don't need a lot of state management, it's really simple and awesome.

bmacho 6 days ago||
> If you never seen HTMX it is a small js library that lets you swap some part of your dom with the responses from your webserver.

> This means that in theory you don't need js, nor do your users need to download a full page like it's 1999. Your webserver replies with fully server-renderd HTML but just for the dom node (say a div) that you want to replace.

You got this backwards. With HTMX you need js. But just to swap a div, you can use link target + iframe, like it's 1999.

ndr 6 days ago||
You [as a dev] don't need [to write] js.

Your browser will still run js. See sibling thread.

srfrog 6 days ago||
I'm the CEO of HTML. I approve of unpoly. A+++++
tantalor 6 days ago||
The author has never heard of jQuery
bjord 6 days ago||
please just try TLS
littlecranky67 6 days ago||
Can we see a styled date-time picker in htmx?
yawaramin 6 days ago|
Yeah, https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...
littlecranky67 5 days ago|||
I can tell you, it is neither styled, nor does it work on Firefox (as in, properly works). And the mobile UX is horrible.
yawaramin 5 days ago||
Perhaps Firefox should focus on shipping a good native datepicker instead of trying to put AI in the browser.
littlecranky67 4 days ago||
True, but completely unrelated to the original thread and issue at hand.
yawaramin 4 days ago||
This should be the issue at hand. Browsers shipping unfinished, sub-standard UI widgets should be a bigger concern for everybody than the random Joe Framework of the week not re-implementing the same widgets.
adamzwasserman 6 days ago|||
took the words out of my mouth!
dana321 6 days ago||
_another fucking framework_
robinhood 6 days ago|
Yet another thread of React vs the rest of the world. Each has its use case, and most of the time, React/Vue are largely overkill. Personally, I would never, ever, ever start another React project again. The nightmare of the horrible JS ecosystem, build steps and tooling is behind me. All my projects now use either HTMX or Alpine Ajax - and for web apps that are actually pretty large. It works perfectly fine. Add Turbo to the mix and you almost have the feeling of using a real SPA, without the headache and large bundled JS files. Feels refreshingly simple. Still have to figure out the no-build step so I can completely drop Bun/Yarn/Npm, and life will be a wonderful thing.
More comments...