Fork me on GitHub
David Vujic06:05:15

One simplistic approach is to have a command basically copying the css (probably in a “dist” folder within the package in node_modules), and add it as an html tag in your html template. If you don't want to set up a postcss/webpack flow. Something like this in package.json: `"scripts": { "copy-css": "cp ./node_modules/@mylib-xxxx/dist/the-css….css ./public/css/the-css”`


hey, 👋 there's no hook for the first initial compile, correct?

Carlo10:05:36 comes to mind, but I'm not sure what you're searching for


yeah, I mean only for the first compile, ie when the app is ready, but I can do it with a compile hook that only does something the first time it's called


yeah, just put something in the build state so you know it ran already

👍 1

to shadow.cljs.devtools.cli-actual/main I mean or should i be using a different entrypoint?


why are you calling that at all? that is only the entry point for the command line tools. what is the goal there?


thanks, yeah that’s better. I thought it would be much more work to get the same thing but turns out it’s only two lines 🙃


only difference to my invocation via main is that I’m seeing a few extranous log lines

May 07, 2022 1:43:39 PM io.undertow.Undertow start
INFO: starting server: Undertow - 2.2.4.Final
May 07, 2022 1:43:39 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.8.0.Final
May 07, 2022 1:43:39 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.8.0.Final
May 07, 2022 1:43:39 PM org.jboss.threads.Version <clinit>
INFO: JBoss Threads version 3.1.0.Final
May 07, 2022 1:43:40 PM io.undertow.Undertow start
INFO: starting server: Undertow - 2.2.4.Final
shadow-cljs - HTTP server available at 


do you do something in shadow to silence those that I can copy?


do you use jvm logging in any way? log4j, logback etc?


not to my knowledge


btw if you drive all this from the clojure api


you could get more access to stuff without need a build hook


like a different kind of callback you mean?


have a pointer for this?


well. what are you looking to do?


do something after the first flush


well shadow.cljs.devtools.api/watch returns when the build finishes. that might be enough?


oh yes, perfect


so just (shadow/watch :the-build) (do-stuff) sequentially should be fine


should simplify things a bit, thanks you!


why are you starting 2 nrepl servers? 😛


shadow-cljs starts one. might be useful since that one also supports cljs while the other one does not?


disabled the shadow one and starting it myself in order to start it earlier


but haven't benchmarked the difference yet


I've given up on cljs repls


booting only nrepl takes 4-5s on my machine, and nrepl via shadow adds another ~3 seconds…


another small things why I’m starting nrepl manually: then the same port file is written regardless of when I use jack-in (for clj-only dev) vs starting only shadow


unsure if it might make sense for shadow to delete .nrepl-port when it boots. Maybe after checking that there’s nothing listening on the port but might also be too much magic…


no, shadow won't delete that file as that would interfere with stuff it doesn't control. it writes its own .shadow-cljs/nrepl.port file


yeah, but when I kill the process that’s writing .nrepl-port and start shadow afterwards I manually need to delete it


no big deal and probably not a common problem


I don't understand the issue sorry 😛


when working on clerk, I sometimes do clj-only dev, and jack-in using cider, so shadow isn’t even on the classpath. This writes a .nrepl-port file. When I kill that process or it dies, the .nrepl-port sticks around, and when I launch nrepl via shadow next time, cider doesn’t consider shadow’s shadow-cljs/nrepl.port file, because the other one takes precedence and I need to manually delete it so I can connect again.


like I said, I believe it’s a pretty rare edge case.


seems like something cider should handle on its own? I mean it knows if the connect succeeded or not?

👍 1
Yuhri Graziano Bernardes14:05:11

Hi everyone. Hope you are all doing well! What docker image do you use to run shadow-clj apps? I found these two, but they seem kinda unmaintained


Do you mean, to compile the code? I usually use a node docker image with Alpine and just install OpenJDK on it

Yuhri Graziano Bernardes22:05:58

I mean use as runtime (for dev and prod)


I have no idea what you mean then... Shadow-cljs is only to compile ClojureScript into Javascript, the resulting code is pure JS and you only need to run on a webserver (for browser targets), or on node (for node library and script targets), or at Android and iOS (for react-native). In that sense, maybe you need to look for a apache or nginx docker, or a node docker to run your compiled code?


Is there any way to use def but alter the :arglists meta? I tried the suggested solutions but they all failed to update :arglists (tried with alter-meta!, that didn't change any metadata at all, tried with (declare ^{:arglists '([a b])} my-fun)`, that also didn't work)


I've reported a similar problem in cljs itself. Might not be shadows bug


var metadata doesn't exist at runtime in cljs. if only lives in the analyzer data on the compiler CLJ side. as such any var based meta programming is severly limited and imho should not be considered at all. just treat it as if vars don't exist. what is your goal with modifying :arglists?