← Back to context

Comment by mikedelago

3 days ago

The beauty of it is that you don't _need_ Alpine at all, Alpine just comes up because it's popular, it solves the problem of lightweight inline scripting, and it integrates relatively seamlessly with htmx.

If you don't want to use Alpine for whatever reason, you can just write your own javascript, you can use hyperscript, you can use some other inline scripting library.

Mr. HTMX touches on it in one of the essays: https://htmx.org/essays/hypermedia-friendly-scripting/

> when I need to work with json - since I don't control all backend and json isn't really a first class citizen of htmx

yeah, if you can't make the backend return HTML, you're in a worse off place if you want to use htmx.

There's extensions [1][2] for receiving and rendering JSON responses with htmx (though I haven't used them), but I totally understand it starting to feel like a worse fit.

1 - https://github.com/bigskysoftware/htmx-extensions/blob/main/...

2 - https://github.com/mariusGundersen/htmx-json