This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-12
Channels
- # beginners (58)
- # boot (4)
- # calva (1)
- # cider (13)
- # cljdoc (1)
- # cljs-dev (7)
- # cljsrn (14)
- # clojure (93)
- # clojure-canada (1)
- # clojure-conj (1)
- # clojure-germany (1)
- # clojure-italy (6)
- # clojure-losangeles (3)
- # clojure-nl (8)
- # clojure-spec (6)
- # clojure-uk (77)
- # clojurescript (3)
- # cursive (5)
- # data-science (6)
- # datomic (52)
- # emacs (1)
- # figwheel-main (2)
- # fulcro (6)
- # graphql (7)
- # jobs (9)
- # leiningen (1)
- # luminus (15)
- # mount (14)
- # off-topic (94)
- # pedestal (1)
- # re-frame (7)
- # reagent (10)
- # shadow-cljs (75)
- # spacemacs (4)
- # test-check (15)
- # tools-deps (23)
- # unrepl (1)
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"
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.
https://www.reddit.com/r/Clojure/comments/4k6d64/how_can_i_handle_html_files_in_luminus_which/
I've tried to follow this example from yogthos however there are now MIME type problems which I don't understand
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.
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
for which you'd have to change the ring-defaults
middleware options so that they're loaded from the file system