Learning ClojureScript by Reimplementing htmx

Inspired, in part, by these blog posts about giving CLJS a try before reaching for a framework htmx and by someone else’s blog post (that, unfortunately, I can’t find at the moment) about how accessibly the code base for htmx is; I have embarked on a little adventure in learning!

I’ve started replacing the parts of htmx I’ve been using in my Biff project with a CLJS version that’s not nearly as fancy as the one in the blog post linked above. More of a drop-in replacement, so I don’t have to change much of back-end code, and so if I need to, I can easily fall back to htmx. I’m not well-versed in JavaScript or the DOM, so it’s been a bit of a challenge, but a really good one, with clear goals I can accomplish step-by-step, and being able to see how htmx handles something has both helped me out of some tangled messes and shown some of the strengths of CLJS.

Biff has been great for this kind of exploration. I really appreciate how easy it is to just swap some part of it out for something else.

1 Like

This is cool! I’ve been mulling over ideas for an upcoming “understanding htmx” essay (e.g. what it is, how to use it, is it a good fit for your project) and I was thinking of at least throwing in a little JS snippet showing how to do the equivalent of a simple hx-post or something. Sounds like that sort of thing would be useful.

This might’ve been the other article: </> htmx ~ Why htmx Does Not Have a Build Step

1 Like

The very one!

A little JS snippet could be helpful. I’m certainly finding it enlightening digging through the code. Well, except for the hx-push-url feature. I can’t quite wrap my head around the History API yet. Fortunately, I figure if I need that, I’m probably dipping my toes into something a little beyond htmx.

1 Like

Yeah, I’ve never needed to hx-push-url myself yet.

1 Like

Thanks for posting. Helpful.

1 Like