Fork me on GitHub
#shadow-cljs
<
2023-04-02
>
Ben Lieberman15:04:48

Question about :watch-dir: if my server's resource handler root is public/assets, should :watch-dir be the subdirectory I want to reload? in this case my directory structure is

- resources
  - public
    - assets
      - css
      - js
but I can't get the CSS to reload

thheller15:04:17

whats the path the css is loaded from /css/foo.css or /assets/css/foo.css?

Ben Lieberman16:04:40

assets/css/styles.css

thheller16:04:15

then resources/public seems to be your root? so :watch-dir "resources/public"

Ben Lieberman17:04:30

this is the route I'm using in Reitit

["assets/*" {:handler (r/create-resource-handler {:root "public/assets"})}]
:root is "public" if not specified.

Ben Lieberman17:04:00

I'm also using deps.edn for source paths, but I'm guessing that doesn't matter.

thheller17:04:38

yep, still fits?

Ben Lieberman17:04:41

yeah, doesn't work for some reason. I'll tinker with it

thheller17:04:56

I'm assuming here that this handler is at the ROOT. so /assets/css/foo.css

thheller17:04:22

you said assets/css/styles.css which is a relative path, so if its somewhat deeper nested that will not work

thheller17:04:39

what is the actual final url for the css file?

Ben Lieberman17:04:29

Absolute path is /home/slothrop/Documents/clojure/cljs/stats/resources/public/assets/css/styles.css and then in my link it's /assets/css/styles.css

thheller17:04:10

not talking about your filesystem path, that is irrelevant

thheller17:04:50

but the second part is the relevant bit, so that seems fine

thheller17:04:17

check the browser console, could be that shadow-cljs tries to reload the css file but just gets an older cached version from your server?

Ben Lieberman17:04:57

I don't see the usual load CSS message from shadow, just the ready message

thheller17:04:21

and you are setting :watch-dir in the correct location in the build config? i.e. in :devtools?

thheller17:04:38

sounds correct then