This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-24
Channels
- # announcements (39)
- # aws (4)
- # babashka (18)
- # beginners (32)
- # biff (10)
- # calva (22)
- # clj-kondo (11)
- # clj-on-windows (2)
- # cljs-dev (20)
- # clojure (31)
- # clojure-europe (130)
- # clojure-norway (21)
- # clojure-spec (24)
- # clojure-uk (17)
- # clojured (2)
- # clojurescript (6)
- # conjure (1)
- # core-async (5)
- # cursive (11)
- # datalevin (1)
- # datomic (9)
- # emacs (24)
- # figwheel-main (42)
- # fulcro (6)
- # gratitude (6)
- # honeysql (8)
- # juxt (16)
- # kaocha (6)
- # lsp (235)
- # malli (2)
- # nbb (7)
- # off-topic (23)
- # other-languages (24)
- # pedestal (7)
- # reitit (6)
- # sci (1)
- # shadow-cljs (21)
- # tools-build (22)
- # tools-deps (57)
- # vim (24)
I am trying to transform my production web service from using clojure
to compiling an uberjar and running this using java -jar
. Apparently, this is wreaking havoc on file access!
The latest issue I am running into is that rather than serving my main.css
, which is served fine when running in the REPL, I get servedanother main.css
from the resource path. This other main.css is brought in by a library. I have have this set in my context map:
::http/resource-path "/public"
In my HTML I have <link href="/css/main.css" rel="stylesheet">
, but Pedestal fetches the resource at /public/css/main.css
rather than the file in the same path.TL;DR Pedestal serves me random resources in libraries rather than the CSS file that’s on disk. How can I make it serve me files on disk?
Do I seriously need to write a custom classloader just to get Pedestal to prefer files on disk…? 😮
@rolthiolliere oh, I did not know about this. Gonna try this out! Thanks.
however if the css file is linked to the app you may want to deliver it the the jar as a resource anyway. I would assume that if you set the resource path correctly in the uberjar conf it would prefer the app's resources to a lib's resources when there is a conflict
Yeah, I learned some more about resource paths over in #clojure-europe so I guess I can just make a different directory structure to avoid the shadowing entirely: https://clojurians.slack.com/archives/CBJ5CGE0G/p1656063632492859