squint 2025-10-15

@borkdude suggested I post about Eucalypt on Show HN: https://news.ycombinator.com/item?id=45590740

I want to add a small slider-based calculator to a webpage on my website. sort of like the ohm demo. I'm using Eleventy to build the site. would using eucalypt and the string eval method from squint be a bad idea? the "business logic" is just some 170 of clojure so I really dont want to bring a big dep to make the component but also dont want to translate from clj to js 😛

you can of course do this, similar to what's happening on the playground: https://squint-cljs.github.io/squint/?src=KG5zIGRlbW8KICAoOnJlcXVpcmUKICAgWyJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2V1Y2FseXB0QDAuMC4zLytlc20iIDphcyByXSkpCgooZGVmbiBuZXctZ2FtZSBbXQogIHs6Ym9hcmQgKHZlYyAocmVwZWF0IDkgbmlsKSkKICAgOngtdHVybj8gdHJ1ZX0pCgooZGVmb25jZSBzdGF0ZSAoci9hdG9tIChuZXctZ2FtZSkpKQoKKGRlZm4gd2lubmVyIFtib2FyZF0KICAobGV0IFtsaW5lcyBbWzAgMSAyXSBbMyA0IDVdIFs2IDcgOF0KICAgICAgICAgICAgICAgWzAgMyA2XSBbMSA0IDddIFsyIDUgOF0KICAgICAgICAgICAgICAgWzAgNCA4XSBbMiA0IDZdXV0KICAgIChzb21lIChmbiBbW2EgYiBjXV0KICAgICAgICAgICAgKHdoZW4gKGFuZCAoZ2V0IGJvYXJkIGEpCiAgICAgICAgICAgICAgICAgICAgICAgKD0gKGdldCBib2FyZCBhKSAoZ2V0IGJvYXJkIGIpIChnZXQgYm9hcmQgYykpKQogICAgICAgICAgICAgIChnZXQgYm9hcmQgYSkpKQogICAgICAgICAgbGluZXMpKSkKCihkZWZuIHNxdWFyZSBbaV0KICAobGV0IFt7OmtleXMgW2JvYXJkIHgtdHVybj9dfSBAc3RhdGUKICAgICAgICBtYXJrIChnZXQgYm9hcmQgaSldCiAgICBbOmRpdiB7OnN0eWxlIHs6d2lkdGggIjYwcHgiIDpoZWlnaHQgIjYwcHgiCiAgICAgICAgICAgICAgICAgICA6Ym9yZGVyICIxcHggc29saWQgIzAwMCIKICAgICAgICAgICAgICAgICAgIDpkaXNwbGF5ICJmbGV4IiA6YWxpZ24taXRlbXMgImNlbnRlciIKICAgICAgICAgICAgICAgICAgIDpqdXN0aWZ5LWNvbnRlbnQgImNlbnRlciIKICAgICAgICAgICAgICAgICAgIDpmb250LXNpemUgIjI0cHgiCiAgICAgICAgICAgICAgICAgICA6Y3Vyc29yICJwb2ludGVyIn0KICAgICAgICAgICA6b24tY2xpY2sgIyh3aGVuIChhbmQgKG5pbD8gbWFyaykgKG5vdCAod2lubmVyIGJvYXJkKSkpCiAgICAgICAgICAgICAgICAgICAgICAgIChzd2FwISBzdGF0ZSB1cGRhdGUgOmJvYXJkIGFzc29jIGkgKGlmIHgtdHVybj8gIlgiICJPIikpCiAgICAgICAgICAgICAgICAgICAgICAgIChzd2FwISBzdGF0ZSB1cGRhdGUgOngtdHVybj8gbm90KSl9CiAgICAgbWFya10pKQoKKGRlZm4gYm9hcmQtdmlldyBbXQogIChsZXQgW3s6a2V5cyBbYm9hcmRdfSBAc3RhdGVdCiAgICBbOmRpdiB7OnN0eWxlIHs6ZGlzcGxheSAiZ3JpZCIKICAgICAgICAgICAgICAgICAgIDpncmlkLXRlbXBsYXRlLWNvbHVtbnMgInJlcGVhdCgzLCA2MHB4KSIKICAgICAgICAgICAgICAgICAgIDpncmlkLXRlbXBsYXRlLXJvd3MgInJlcGVhdCgzLCA2MHB4KSIKICAgICAgICAgICAgICAgICAgIDpnYXAgIjJweCJ9fQogICAgIChmb3IgW2kgKHJhbmdlIDkpXQogICAgICAgXns6a2V5IGl9IFtzcXVhcmUgaV0pXSkpCgooZGVmbiBnYW1lIFtdCiAgKGxldCBbezprZXlzIFtib2FyZCB4LXR1cm4%2FXX0gQHN0YXRlCiAgICAgICAgdyAod2lubmVyIGJvYXJkKV0KICAgIFs6ZGl2IHs6c3R5bGUgezpmb250LWZhbWlseSAic2Fucy1zZXJpZiJ9fQogICAgIFtib2FyZC12aWV3XQogICAgIChjb25kCiAgICAgICB3IFs6cCAoc3RyICJXaW5uZXI6ICIgdyldCiAgICAgICAoZXZlcnk%2FIHNvbWU%2FIGJvYXJkKSBbOnAgIkRyYXchIl0KICAgICAgIDplbHNlIFs6cCAoc3RyICJOZXh0IHR1cm46ICIgKGlmIHgtdHVybj8gIlgiICJPIikpXSkKICAgICBbOmJ1dHRvbiB7Om9uLWNsaWNrICMocmVzZXQhIHN0YXRlIChuZXctZ2FtZSkpfQogICAgICAiUmVzdGFydCJdXSkpCgooci9yZW5kZXIKICBbZ2FtZV0KICAob3IKICAgIChqcy9kb2N1bWVudC5nZXRFbGVtZW50QnlJZCAiYXBwIikKICAgIChkb3RvIChqcy9kb2N1bWVudC5jcmVhdGVFbGVtZW50ICJkaXYiKQogICAgICAoYXNldCAiaWQiICJhcHAiKQogICAgICAoanMvZG9jdW1lbnQuYm9keS5wcmVwZW5kKSkpKQ%3D%3D but note that your website will just be a little bit bigger

you could also just translate your CLJS on the squint playground and copy paste it ;)

or you can use scittle alternatively which has reagent too

but if you want a small JS website, definitely go with npm create eucalypt myapp

thanks I'll take a look!

@slack.jcpsantiago co-incidentally I recently found someone using eleventy with squint: https://github.com/flmng0/tmthy.dev

We're too early.

The world is not ready for 10kb cljs frontends. 👽

Nice! Note that direct links are kind of punished on HN

@slack.jcpsantiago if you do end up trying Eucalypt it would be good to hear the experience report whether you continue with it or not.

@borkdude that's cool thanks! @chris358 sure thing 👍 I'm not sure yet if where and how I'll implement what I need to do, I'm currently collecting options. Either do it inside our cljd app, or server-side with datastar or something like Eucalypt. I'll let you know.

👍 1

any tips on getting the defclass macro to work nicely with clj-kondo? I tried the classic squint.core/defclass clojure.core/defrecord but it lacks knowledge of things like extends super etc

true, probably best to just configure clj-kondo to ignore stuff inside this macro

👍 1

{:config-in-call {squint.core/defclass {:ignore true}}}