Live data from Hacker News

Why you should choose HTMX for your next web-based side project (2024)

hamy.xyz

1–10 of 81 posts

Re: Why you should choose HTMX for your next web-based side project (2024)

#3
I'm toying around with HTMX for my website. It's going to be sort of a wiki but a little different; the public exports from my internal knowledgebase with some extra crap mixed in.

I have lots of notes of varying types and formats. Org-mode files are all pretty standard, but there's like 3 different Markdowns and an untold number of randomly-formatted .TXT files. I want to generate their webpages on-the-fly and not have to worry about exporting it.

One of the "crap mixed in" things I want is to integrate parts of a gitweb-like interface into the notes. I reference repos and commits regularly in my notes. Would be neat to mouse-over them and get a little popup with basic info about it.

I also like that the author refers to themselves as a Technomancer. Personally I'm an metamagical artificer. I love meeting fellow adventurers.

Re: Why you should choose HTMX for your next web-based side project (2024)

#5
I can't believe they still don't have a way to parse JSON responses automatically.

If you combine e.g. hx-post with hx-target, then it will put the text from the response into the target selector... but there is no "hx-source" to select what part of the response to use.

I'd really love to be able to set e.g. hx-source="somejsonfield" instead of having to manually handle the response with a custom function that parses/error checks the json and then sets the selector's text to the value of a json key. It could really save a lot of boilerplate code IMO.

Re: Why you should choose HTMX for your next web-based side project (2024)

#8

I can't believe they still don't have a way to parse JSON responses automatically. If you combine e.g. hx-post with hx-target, then it will put the text from the response into the target selector... but there is no "hx-source" to select what part of the response to use. I'd really love to be able to set e.g. hx-source="somejsonfield" instead of having to manually handle the response with a custom function that parses…

The philosophy of HTMX is not to send JSON, but HTML fragments.

Re: Why you should choose HTMX for your next web-based side project (2024)

#9

I can't believe they still don't have a way to parse JSON responses automatically. If you combine e.g. hx-post with hx-target, then it will put the text from the response into the target selector... but there is no "hx-source" to select what part of the response to use. I'd really love to be able to set e.g. hx-source="somejsonfield" instead of having to manually handle the response with a custom function that parses…

The philosophy of HTMX is not to send JSON, but HTML fragments.

They didn't mention sending JSON though... and you can absolutely return HTML fragments in a JSON response.
Post reply on HN