luminus

jcb 2018-10-12T13:33:37.000100Z

Is there a clean way to define where the resources folder will be once a luminus app is jarred? Other than setting all my paths to "../etc"

jcb 2018-10-12T13:34:00.000100Z

Thanks!

Azzurite 2018-10-12T15:25:57.000100Z

What do you mean with "where it will be"? In JVM programs, the resources folders are contained inside of the .jar, and you will generally not have to worry about "where" exactly they are as everything's managed. If you want to load external files (outside of the jar) those have nothing to do with the "resources" or resource paths you define in your project. You simply use (slurp <FILEPATH>) (or whatever) to read external files.

Azzurite 2018-10-12T15:26:34.000100Z

also I like that you called it "jarred" 😄

jcb 2018-10-12T15:27:06.000100Z

complijarred?

jcb 2018-10-12T15:28:27.000100Z

I've tried to follow this example from yogthos however there are now MIME type problems which I don't understand

jcb 2018-10-12T15:29:33.000100Z

Azzurite, I'd like to be able to update the media resources but not compile each time

Azzurite 2018-10-12T15:44:10.000100Z

You have to remember that Luminus is not its own thing, but simply a collection of different libraries. For example, your HTML templates are handled by selmer (https://github.com/yogthos/Selmer#resource-path), so if you set selmer's resource path, that's where the HTML template files will come from. However, media resources are served by a ring middleware (you should be familiar with https://github.com/ring-clojure/ring/wiki/Concepts as Ring is the basis for every Clojure webapp). I'm not absolutely familiar with if Luminus uses the same libraries with all parameters, but the reagent template I have here uses https://github.com/ring-clojure/ring-defaults which by extension uses ring.middleware.resource and ring.middleware.file. You can see in the ring-defaults documentation that you have to change the :static->`:files` configuration parameter to serve static files from the file system.

Azzurite 2018-10-12T15:47:11.000100Z

and yeah, the example from yogthos only changes the Selmer template path, but you're talking about "media resources", so I imagine you mean stuff like images

Azzurite 2018-10-12T15:48:20.000100Z

for which you'd have to change the ring-defaults middleware options so that they're loaded from the file system

jcb 2018-10-12T16:04:21.000100Z

ok thanks for the detailed answer!

Azzurite 2018-10-12T16:06:48.000100Z

let me know if it helps, I've actually never used this stuff before 😄

jcb 2018-10-12T16:08:03.000100Z

ok, ideally, the whole folder would sit outside the jar as the logic will stay the same but styling/images will change

jcb 2018-10-12T16:08:37.000100Z

I'll give it a go, cheers 👍