Fork me on GitHub
#shadow-cljs
<
2021-05-26
>
maxt12:05:33

@thheller First, I find shadow-cljs to be an amazing piece of software, thank you! I like to turn autobuild off, but then I would like it to recompile if I reload the browser. Is there a simple way to achive that?

maxt12:05:08

I imagine some kind of before-load function on the java side that can call compile!

thheller13:05:18

@maxt you can toggle the autobuild from a CLJ REPL via (shadow/watch-set-autobuild! :the-build false) and then trigger a compile via (shadow/watch-compile! :the-build).

thheller13:05:57

a compile trigger when you reload the browser does not exist

Christopher Stone13:05:53

Hello @thheller, I've just created a pull request to add a shim file to the shadow-cljsjs library, whould you be so kind as to review the changes and accept. This is my first shim file created and any pointers would be appriciated, Thanks

thheller13:05:52

why did you create it? I can't find the keycloak-js package here https://github.com/cljsjs/packages

thheller13:05:25

also which library is using the cljsjs.keycloak-js?

Christopher Stone13:05:32

I want to expose the Keycloak global variable after installing keyclaok-js (using yarn add keycloak-js), as our code is not able to access it using js/Keycloak

thheller13:05:37

why do you want to access it via js/Keycloak? if this is just for your code and not a public library then put the shim file onto your classpath. no need for it to be in shadow-cljsjs

thheller13:05:16

just (:require ["keycloak-js" :as keycloak-js] in your code and use keycloak-js instead of js/Keycloak?

thheller13:05:54

no need for this cljsjs indirection if its your code anyways and not some official cljsjs package you are trying to replace

Christopher Stone13:05:51

OK thanks for the prompt reply, I will let you know if there are any further issues 🙂

lispers-anonymous16:05:46

I use keycloak with shadow-cljs regularly. Pulling it in through NPM and using it with (:require ["keycloak-js" :as keycloak-js]) works great for me. If you have any specific questions about it I'd be glad to answer them.

maxt13:05:24

@thheller to create a compile-on-reload trigger, could I write a cljs :before-load function that somehow signals the shadow server to recompile?

thheller13:05:19

no, before-load is triggered after a compile completes. not when the browser reloads.

thheller13:05:06

if you have a custom server, that could trigger the recompile when the request comes in

maxt13:05:23

ok, make sense.

maxt13:05:26

ah, right.

maxt13:05:42

Yes that would solve it, thanks!