Fork me on GitHub
#shadow-cljs
<
2023-05-01
>
danielstockton13:05:29

shadow-cljs is reloading my css relative to the current domain, rather than the domain which originally loaded the css, leading to broken styles. Is there any way to fix that without turning off the reloading?

thheller14:05:13

hmm? why is the domain changing? it reloads with the path it found in your html, so not sure what you mean.

thheller18:05:17

how are you including the css in your html? easiest might be to have the 3000 server serve the css, I'm otherwise confused about what your setup is

danielstockton18:05:21

It's fully qualified on localhost:8280, but when it reloads it seems to use the relative path and switch to localhost:3000 which is serving the HTML. I'll try and get everything on the same port for simplicity

thheller21:05:32

the code looks at the current domain on page load and only reloads css from that domain

thheller21:05:12

so how you even get it to reload something from another domain I don't understand?

danielstockton18:05:28

It does not initially load relative to the current domain, it loads on another domain (or rather port). However, when shadow-cljs reloads it, it reloadsrelative to the current [page] domain. I will work around it and try to serve everything from the same domain/port.

thheller18:05:55

so what is the <link href=""> attr in your html? I assume http://localhost:8280/whatever.css?

danielstockton18:05:30

Yep, exactly. And the html is served on localhost:3000. When the css reloads, it tries to load it on localhost:3000.

danielstockton18:05:50

I should be able to proxy the files via localhost:3000 as well, fairly easily

thheller18:05:03

maybe nobody has ever done that setup before, could totally be buggy

thheller18:05:34

shadow-cljs also supports proxying, so it could proxy to 3000

danielstockton18:05:14

But that would conflict with my node server that's already running on 3000, would it not?

thheller18:05:31

proxy. you keep it running on 3000 and just use 8280 or whatever port you want

thheller18:05:47

requests that server can't answer, then go to 3000