This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-30
Channels
- # aws (4)
- # beginners (143)
- # boot (37)
- # cider (31)
- # cljs-dev (53)
- # clojure (303)
- # clojure-conj (5)
- # clojure-dev (106)
- # clojure-dusseldorf (2)
- # clojure-greece (3)
- # clojure-italy (23)
- # clojure-spec (83)
- # clojure-uk (7)
- # clojurescript (328)
- # core-async (25)
- # cursive (2)
- # datascript (2)
- # datomic (3)
- # emacs (10)
- # hoplon (1)
- # jobs (2)
- # lein-figwheel (1)
- # leiningen (13)
- # luminus (6)
- # off-topic (38)
- # onyx (2)
- # parinfer (13)
- # pedestal (2)
- # portkey (5)
- # re-frame (11)
- # reagent (2)
- # shadow-cljs (61)
- # specter (6)
- # unrepl (60)
- # vim (4)
hey there, just wondering how do you guys create an uberjar with clojurescript sources compiled? I have a simple task (comp (build) (aot) (uber) (jar))
where "build" is a (comp (cljs) (sass))
. both "src/clj" and "src/cljs" are listed in :source-paths
. Now, not only aot task tries to compile cljs files (most likely because they're mentioned as sources), but also main.out directory with whole bunch of intermediate javascript files is unnecessarily added to uberjar increasing its size.
in general everytime I try to do something with clojurescript I have again to scratch my head whether clojurescript sources should be mentioned in :source-paths
. if so, that implicates some strange results like the one I described.
also, is there any way to differentiate (based on some pattern matching) which other tasks reload
task should trigger? eg. when cljs are changed I'd like to trigger (cljs)
task, but if scss are altered I'd like to trigger (scss)
one. as for now, no matter which file is changed both tasks are unnecessarily triggered.
@michal fwiw, this is what we use:
:source-paths #{"test" "src-cljs"}
(deftask build-cljs []
(set-env! :source-paths #(conj % "src-cljs-prod"))
(cljs :optimizations :advanced
:source-map true
:compiler-options {:foreign-libs foreign-libs}))
(deftask build-less []
(less :source-map false :compression true :inline-javascript true))
(deftask build []
(comp (include-assets) (build-cljs) (build-less) (aot) (pom) (uber)
(jar :file "app-standalone.jar")
(sift :include #{#"app-.*\.jar"}) (target)))
I extracted the uberjar to see what’s in it and in our case it also includes the .cljs files. Is that bad? I don’t know. Let me think about it.
@borkdude thanks, that looks very similar to what I have and I guess you also have a entire main.out (or similar) with all the cljs-es in your uberjar 🙂
I think it shouldn't be hard simply to remove these sources before uberjar-ing, but I didn't figure it out yet
I'm slowly starting looking at shadow-cljs to handle clojurescript part of app. seems like it might be better (and faster) solution than boot's cljs & reload tasks. the only problem is that it doesn't play nice with boot's immutable filesets philosophy.
great, I will check it out. I'm looking now at juxt's edge and I'm amazed how gathered all the cool stuff into one place 🙂