shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
2021-05-26T12:40:33.133400Z

@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?

2021-05-26T12:54:08.134200Z

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

thheller 2021-05-26T13:24:18.135400Z

@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).

thheller 2021-05-26T13:24:57.136100Z

a compile trigger when you reload the browser does not exist

Christopher Stone 2021-05-26T13:33:53.139700Z

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

thheller 2021-05-26T13:35:52.140200Z

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

thheller 2021-05-26T13:37:25.141600Z

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

Christopher Stone 2021-05-26T13:40:32.143300Z

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

thheller 2021-05-26T13:41:37.144200Z

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

thheller 2021-05-26T13:42:16.144600Z

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

thheller 2021-05-26T13:42:54.145200Z

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

Christopher Stone 2021-05-26T13:43:51.145800Z

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

2021-05-26T13:56:24.148Z

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

thheller 2021-05-26T13:57:19.148800Z

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

thheller 2021-05-26T13:58:06.149300Z

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

2021-05-26T13:58:23.149500Z

ok, make sense.

2021-05-26T13:58:26.149700Z

ah, right.

2021-05-26T13:58:42.150Z

Yes that would solve it, thanks!

lispers-anonymous 2021-05-26T16:00:46.150100Z

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.