Fork me on GitHub

Is there a canonical way to use JS plug-n-play libraries with Biff, i.e. Quill text editor or D3.js charts? I’m a huge fan of writing pages in Hiccup, but can’t quite see how to cleanly interop.

Jacob O'Bryant23:11:35

I generally just write plain JS either inline or in a separate file depending on how much is needed. e.g. here's an example of using tinymce:


Oh perfect! I was hoping there was some strategy akin to this. Glad to see that it's relatively painless to do both inline and as a resource file. Now I'm half-curious as to what it would look like to add-in really minimal CLJS support :thinking_face: ...though I guess I should probably instead just focus on learning HTMX and Hyperscript. Also, much thanks for your work on the Eelchat tutorial so far, just went through it today. Very excited to learn more!

Jacob O'Bryant18:11:56

CLJS is certainly doable. Downside is it's an extra thing to setup and it adds another step to the build process. Plus the compiled artifact size will always be a lot bigger than a few lines of plain JS. On the other hand, shadow cljs does make it fairly straightforward to setup, and Biff already has a build step for Tailwind CSS, so if you were to add CLJS, you could just add CLJS compilation in all the spots where Biff currently does Tailwind compilation. (However you'd of course still have a longer build time, which could be inconvenient if you do the develop-in-prod thing). Basically I think instead of going for minimal CLJS, best to wait until you really need it, then go all in 🙂. And +1 for learning htmx and hyperscript. And I'm glad you're enjoying the eelchat tutorial!


@U03DKTAF52P I have had exactly the same impulse (and I’m not saying it’s a bad one): can’t I bring in a bit of CLJS? I may yet do it down the road for some cases. But what I’ve found is that the HTMX crew have made a bit of a game out of proving that everything can be done with their approach. And, seemingly, almost all of it can. Their documentation is world class… it seems like whenever I search on, say, ‘htmx active search’, or whatever, I get a complete example. Well, I get it after I tell google that I meant htmx, not html (they like to correct that for me). So so far I’ve managed to stay on board with 100% htmx. Hyperscript has grown rapidly on me… I seem to be able to guess at the script and it will often work.


@U0X9N9ZK5 that’s very reassuring to hear! I’ve been skittish about HTMX and Hyperscript, and we’re currently in the middle of migrating a project to Biff from full-blown Re-frame with a Pocketbase backend—so it’s been a big change and a lot to get used to. But our team is really small (just me and my friend working in our free time), so anything that maximizes bang for the cognitive-load buck is a huge win.