Fork me on GitHub
#shadow-cljs
<
2021-05-29
>
verma00:05:03

So the CSS auto reload is not working for me because I dynamically load the CSS (based on tenant configuration), the setup is similar in development also, and I read in the documentation that any absolute references CSS resources should auto load. I was wondering if there's a way for me to explicitly instruct shadow to watch certain CSS files at certain paths?

verma00:05:55

Ok, I coded the path in instead of keeping it dynamic, but still I don't see any reloads happening hmm. Double checking things.

verma00:05:58

As far as I can tell config looks ok 😞

thheller07:05:53

and what does the config look like? 😛

thheller16:05:59

note that in shadow-cljs you don't need separate dev/release builds. one build for both cases is enough.

thheller16:05:29

otherwise looks fine. assuming your CSS files actually reside in resources/public somewhere and that your link tags in the HTML use absolute paths

verma16:05:44

They do 😞 but I will make sure, for sure I am doing something wrong somewhere. Thanks for your help. The debug/release build are just left-over from figwheel days 🙂

thheller17:05:35

paths need to match, thats about it. so resources/public/whatever/foo.css would be /whatever/foo.css in the HTML

thheller17:05:17

assuming of course you use the server on :3449

thheller17:05:46

this looks somewhat suspicious :devtools-url "". don't know why you are doing that

thheller17:05:52

suggests that you are using another server inbetween that maybe mucks with the paths

thheller17:05:39

in which case you might to tweak the :watch-path "/foo" option (prefix)

verma17:05:37

yes, there is an nginx proxy sitting in the middle which proxies requests to shadow-cljs and the backend ... that's a good point, I will check what its re-writing this path to. I will also check directly against :3449 .. thanks for the suggestions!

verma17:05:18

I see that nginx is not doing anything funky with re-writing URLs, but let me check how it works with direct connection to :3449

verma18:05:17

Ok, it seems to be running through :3449 🎉 .. I am looking into what's up with going through proxy.

verma18:05:35

I am not sure what I did but it all seems to be working now. The only change I made was that I exposed port 3449 on to the host from my docker container. But its all working now even with dynamically loaded CSS! Phew! This has been bugging me for a while but its working well now! :thumbsup: thanks for all your help and the amazing shadow-cljs!

verma19:05:33

Ok, here's an observation: I start my dev env and I go to dev.local and the CSS reloading doesn't work. Then I go to dev.local:3449 and although I cannot reach my backend the frontend loads and then if I make a change to my css, it reloads correctly. Then finally, if I go back to dev.local again, the css loading works (with or without /css/style.css).

verma19:05:26

Ok, so I am consistently able to reproduce this, I am not including /css/style.css in my html but shadow-cljs seems to be picking up my dynamic include. I can work around this as long as I visit :3449 first.

Schpaa16:05:31

Shouldn’t pretty-print be the default (or at least persistent) when selected in the inspect latest tab?

Schpaa16:05:13

Or can this be configured somewhere?

Schpaa16:05:45

Context is the Tap History facilities in the browser

thheller16:05:40

in ~/.shadow-cljs/config.edn :js-options {:preferred-display-type :pprint}