Fork me on GitHub
#clojurescript
<
2020-08-03
>
borkdude09:08:32

@cancandan I recommend looking at #figwheel-main for hot reloading goodness

Shako Farhad12:08:53

Anyone know a good QR reader and QR creator library for cljs?

dnolen14:08:43

@shakof91 it should be easy to use an existing JS library for that too

Shako Farhad15:08:21

I am always star struck when you answer! :D We are using leiningen with lein figwheel. I guess for the best use of js libraries and npm we need to go over to shadow-cljs, right? I wish there was a guide on how to setup a complex shadowcljs (with leinigen perhaps) project.clj file. :x

herald19:08:25

@shakof91 The simplest way to use JS libraries for leiningen is https://github.com/cljsjs/packages I see they have two packages when searching for qr. If you want to use any npm package with leiningen, you can use the recently added bundle target https://clojurescript.org/guides/webpack Instead of creating the edn files, you should add the build config to project.clj (`:cljsbuild :builds :your-profile :compiler` I think).

Shako Farhad19:08:03

Oh wow! That is very interesting! We are using lein cljsbuild currently. It would be great to be able to integrate javascript libraries like that. :D Do you have to use things like binaryage/oops for the javascript interop so that advanced compilation works, or does webpack take care of all of the issues with foreign libs etc? :o

herald19:08:00

I haven't tried it myself, but the guide says this > Note the new :target :bundle option. This ensures that the generated code is compatible with popular JavaScript bundlers that can handle Node.js style require. It also sets a bunch of other sensible defaults like externs inference, so that advanced compilation will just work. so it definitely sounds like it!

Shako Farhad19:08:41

That is pretty awesome. I love how clojurescript just keeps getting more and more awesome. :D Thank you sir @U050B88UR!

colliderwriter22:08:27

still kind of cljs newb here. how should i be calling getElementById? via interop or get-element?

lilactown22:08:09

I typically use interop

lilactown22:08:34

honestly never knew about clojure.browser.dom until you asked lol

mruzekw22:08:53

Yeah, might as well keep your usage of deps down

colliderwriter23:08:13

makes sense to me. there's a fine line between idiomatic and idiot pedantic.

dpsutton23:08:36

There’s a goog.dom “namespace” as well