clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
p-himik 2021-06-01T06:23:18.461900Z

There's a link to it here: https://chariotsolutions.com/ete-2021-resources/

đź‘Ť 1
kennytilton 2021-06-01T06:35:24.464900Z

I am working on a re-frame app and need to give some raw HTML to printJS. I can do it with pp/cl-format but thought my non-CL peers might appreciate a Hiccup solution. Is https://github.com/teropa/hiccups the way to go for that? I see Reagent itself renders straight to the DOM, so has no text HTML output capability. Unless I missed it. 🙂

p-himik 2021-06-01T07:04:05.465600Z

I was confused initially, but I think I get what you want now. Just as a clarification - Reagent doesn't render anything. It simply creates React elements, React then makes a vDOM tree out of them, then reconciles it with the real DOM, IIRC. With that being said, you can still use it by creating an off-screen element and putting that HTML inside. Unless it's not just some markup but a proper HTML that can't be put inside <div>. Just in case - if you have a server, then using Clojure might be better. At the very least, it would help you avoid an extra dependency in the browser that would be used for just one thing (actually, cljs.pprint has significant size at all, when bundled with the rest of the app - I wouldn't want to use it for just one thing as well).

kennytilton 2021-06-01T07:25:12.466Z

Right, Reagent just writes to the DOM, that is why I am looking at teropa/hiccups to generate some text HTML to pass to https://printjs.crabbly.com/

thheller 2021-06-01T07:39:38.466300Z

you can always just render into a div and then use (.-innerHTML the-div) to get the full html. if you just have some data and don't need all the rendering stuff reagent/re-frame do then hiccups is fine too.

borkdude 2021-06-01T10:38:46.466800Z

Also note that cljs.pprint isn't very friendly on your bundle size

kennytilton 2021-06-03T00:19:55.483500Z

Yikes! We have two functions in reagent.dom.server: render-to-static-markup and render-to-string! I was googling sth else when these jumped onto my radar. Weird, I had looked for sth like that...ah, I got as far as reagent.dom but never considered r.d.server. sigh

p-himik 2021-06-01T06:55:07.465200Z

Out of interest - what's pp/cl-format?

p-himik 2021-06-01T06:55:25.465400Z

Ah, cljs.pprint, right.

km 2021-06-01T18:03:08.467500Z

Hey, what's the best practice for including a cljs library from a specific commit on github?

borkdude 2021-06-01T20:14:13.468100Z

@kimo deps.edn + :git/url ?

haywood 2021-06-01T22:24:30.469600Z

I run into this issue from time to time when booting my Clojurescript project up:

009 |     (if (js/isFinite o)
1010 |       (js-mod (Math/floor o) 2147483647)
1011 |       (case o
1012 |         ##Inf
--------------------^-----------------------------------------------------------
No reader function for tag Inf
using deps… but running clj -A:dev:test -Stree doesn’t show an outdated tools.reader that doesn’t support the ##Inf literal, and I don’t know how else to debug ⛽ 🔦

alexmiller 2021-06-01T22:28:21.470500Z

Could be tools.reader embedded in something else (like cljs)

haywood 2021-06-01T22:29:44.470900Z

:thinking_face: it’s a pretty recent version of Clojurescript (from the stacktrace):

File: jar:file:/.m2/repository/org/clojure/clojurescript/1.10.773/clojurescript-1.10.773.jar!/cljs/core.cljs:1012:14