Fork me on GitHub
#biff
<
2024-04-07
>
Michael Nardell20:04:20

I was trying to use the HTMX Out-of-Band feature. If I understand correctly, I need to provide two elements in the the response: first one for the target, the second specifies another element id and adds the hx-swap-oob. The biff/render function may not support this "forked" response, and I was thinking of writing my own render function to handle this kind of response. Please let me know if I am missing something if there is something already built in that I can use. Thanks!

Jacob O'Bryant21:04:44

You can do it with Rum's fragment feature: [:<> [:div "first div"] [:div "second div"]]

😮 1
Michael Nardell21:04:59

Thanks Jacob. I am enjoying learning Biff, and it has been a great entry point to HTMX, XTDB and Tailwind.

Jacob O'Bryant21:04:30

glad to hear it!

geraldodev00:05:45

Excuse me for intruding. Is this fragment feature one of the reasons of the rum library usage in Biff? I noticed that rum is called whenever static HTML needs to be rendered. Perhaps @U7YNGKDHA could shed some light on this?

Jacob O'Bryant01:05:03

Originally I picked Rum because it worked the same on clj and cljs--this was before I switched Biff to use htmx instead of cljs. plain hiccup would also be fine, or this: https://github.com/lambdaisland/hiccup

geraldodev01:05:22

I decided to try htmx for a small project at home that I'll possibly use at work if things go right, and biff is reference implementation in clojure. I'm watching https://biffweb.com/p/the-design-of-biff/video right now. I already have a base code with sierra component, postgres, reitit. Is it possible/feasible to use code of biffweb with sierra's component ?

geraldodev02:05:22

even for the Out-of-Band feature weavejester's hiccup could be used ?

geraldodev02:05:31

the re loadable routes in biff are dope. I've accomplished the reloading bit (not the refresh on save) following the metosin doc https://gist.github.com/geraldodev/20b70704bdede9b91608a535f8423164 the routes needs to be functions.

🙌 1
Jacob O'Bryant02:05:36

yep, any of them will be fine for out-of-band. for regular hiccup you should be able to render a list to get multiple top-level elements, but if nothing else you can always call hiccup on each individual element and then put the results together with str.