shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
verma 2021-05-29T00:21:03.274100Z

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?

thheller 2021-05-29T07:48:53.274700Z

and what does the config look like? 😛

verma 2021-05-29T15:37:45.275Z

🙂 thanks for your response https://gist.github.com/verma/7fd227fb6dda8092fbdf9e4a5c45b5cf

thheller 2021-05-29T16:53:59.277400Z

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

thheller 2021-05-29T16:54:29.277600Z

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

verma 2021-05-29T16:57:44.277800Z

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 🙂

thheller 2021-05-29T17:00:35.278Z

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

thheller 2021-05-29T17:01:17.278200Z

assuming of course you use the server on :3449

thheller 2021-05-29T17:01:46.278400Z

this looks somewhat suspicious :devtools-url "<http://dev.local/shadow-cljs>". don't know why you are doing that

thheller 2021-05-29T17:02:52.278700Z

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

thheller 2021-05-29T17:03:39.278900Z

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

verma 2021-05-29T17:09:37.279100Z

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!

verma 2021-05-29T17:57:18.279500Z

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

verma 2021-05-29T18:05:17.279700Z

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

verma 2021-05-29T18:41:35.280100Z

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!

verma 2021-05-29T19:18:33.280300Z

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

verma 2021-05-29T19:25:26.280500Z

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.

verma 2021-05-29T00:32:55.274200Z

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

verma 2021-05-29T00:42:58.274400Z

As far as I can tell config looks ok 😞

Schpaa 2021-05-29T16:07:31.276200Z

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

Schpaa 2021-05-29T16:08:13.276400Z

Or can this be configured somewhere?

Schpaa 2021-05-29T16:08:45.276700Z

Context is the Tap History facilities in the browser

thheller 2021-05-29T16:51:40.277300Z

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

Schpaa 2021-05-29T18:09:40.280Z

🙏