This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-11
Channels
- # announcements (16)
- # architecture (1)
- # babashka (24)
- # beginners (49)
- # biff (5)
- # calva (13)
- # clerk (3)
- # clj-kondo (4)
- # clojure (46)
- # clojure-dev (1)
- # clojure-europe (22)
- # clojure-losangeles (5)
- # clojure-nl (1)
- # clojure-norway (15)
- # clojure-uk (2)
- # clojurescript (28)
- # code-reviews (2)
- # community-development (6)
- # conjure (10)
- # cursive (8)
- # datalevin (15)
- # datomic (32)
- # events (1)
- # fulcro (9)
- # hyperfiddle (32)
- # introduce-yourself (1)
- # lsp (27)
- # malli (1)
- # matrix (3)
- # missionary (6)
- # off-topic (24)
- # practicalli (2)
- # rdf (1)
- # re-frame (7)
- # reagent (10)
- # reitit (5)
- # rewrite-clj (9)
- # sci (6)
- # scittle (4)
- # shadow-cljs (23)
- # tools-deps (74)
- # vim (19)
- # xtdb (5)
Hi, I also have a deployment-related question. How would I go about creating an uberjar with all the assets and the like? I'm struggling to find any docs or deconstruct the existing scripts/tasks to do that myself. Thanks!
There's no code or docs for it, but at a high level you could use tools.build to create the jar, and during the build phase, generate the html files (https://github.com/jacobobryant/biff/blob/master/example/src/com/example.clj#L33) and the css file (https://github.com/jacobobryant/biff/blob/master/tasks/src/com/biffweb/tasks.clj#L129)
OK, took a moment but I figured it out. Just a tip if anyone reads this and has trouble getting it to work: once you get all the assets to compile and get included in the jar, you still need to make a change in the base`` function in your
ui.clj``. I'm not an expert, but I assume the
css-path`` function that's there by default is checking the filesystem for the CSS file, essentially trying to get it from outside the JAR. So you need to hard-code the path to another file that you will use in production, or add some conditional logic to make sure css-path is only run in dev.
ah yes, I believe that's because io/file
doesn't work when you pass it a resource that's inside a jar. You can probably get by with just replacing the (css-path)
call with "/css/main.css"
. I added that function because I was making frequent updates to the production css file due to the develop-in-prod workflow; if you're deploying with jars then presumably it'd be less of an issue. 🤷 . if you've got developer tools open with "disable cache" enabled then you should be fine in dev.
Wouldn't hurt to figure out a way to make that fn work whether the css file is in a jar or not.