scittle

2025-01-07T21:42:45.768259Z

Quick question. Can I embed scittle inside hiccup but as code? Like not as string? Say something like:

[:fieldset
    {:onchange '(-> (JS/querySelector "input[type=\"checkbox\"]") (.setCustomValidity ""))}
    [:legend "Frequency"]
    [:label
     [:input {:type "checkbox" :name "daily"}]
     "Daily"]
    [:label
     [:input {:type "checkbox" :name "weekly"}]
     "Weekly"]
    [:label
     [:input {:type "checkbox" :name "monthly"}]
     "Monthly"]]

jasalt 2025-02-19T19:53:42.556489Z

Some interesting hiccup js transpilation tricks https://scicloj.github.io/tableplot/tableplot_book.transpile_reference.html

jasalt 2025-02-19T19:57:29.099989Z

Also, maybe Datastar could be useful if Htmx gets messy with client side stuff requiring extra libraries etc.

rickheere 2025-02-19T20:44:54.284469Z

Very interesting, thanks!

rickheere 2025-01-09T10:43:23.882399Z

I was in the same situation where I wanted some scripting next to HTMX and I managed to be able to with some clojure code for scripting but in the end it was easier to just go with https://hyperscript.org/. Works pretty well for some small scripts.

2025-01-09T19:49:37.712139Z

I tried hyperscript but didn't love learning a new language.

Luca Panofsky 2025-05-30T08:29:41.472129Z

I also really much lick the combo hiccup + htmx + hyperscript. However, I thought that trying to replace hyperscript with some clojure dialect would have been a good idea, or, at least, a good attempt and so I tried to integrate scittle in this way (see pic) In order to make this working: • a small dom manipulation library embedded in scittle (xdom) • some macros in the server to compile attributes for scittle • a custom eval-string • an observer (for signals, although it's just an experiment) The goal would be to enhance hiccup with client side scripting

borkdude 2025-01-07T22:34:46.040619Z

who converts the hiccup to html, is this server or client side?

2025-01-07T22:41:38.212059Z

Server side

2025-01-07T22:42:20.392239Z

Hum, currently it's the hiccup library from weave jester. But like, is there an alternate hiccup lib that would know to convert the scittle. Or just a lib that I can wrap the scittle code and it'll return it as a string And maybe also, a string that scittle will pickup inside the html?

borkdude 2025-01-07T22:43:56.224839Z

anything rendered in the browser has to be a string with some javascript in there so what you need there is either a compiler (#squint might be a good fit, let me link an example shortly) or a call to the interpreter explicitly, e.g. scittle.core.eval_string(...)

👍 1
borkdude 2025-01-07T22:45:07.469219Z

here are some squint examples using babashka (but this is irrelevant, it can be whatever server side clojure hiccup stuff): https://github.com/squint-cljs/squint/tree/main/examples/babashka

2025-01-08T01:48:15.827199Z

Cool, ya squint might work even better in this case. I'll explore both.

2025-01-08T01:49:29.865189Z

I've found with HTMX you hit some limitations sometimes, and a little bit of embedded JS is needed. Not enough to go and make a separate script file and all that though. But then it's annoying inside hiccup to write some JS inside a string. But writing clojure code, that could be interpreted as scittle or compiled as squint would be much nicer.

➕ 1