plexus / chestnut

Application template for Clojure + ClojureScript web apps
Eclipse Public License 1.0
1.32k stars 99 forks source link

Better document (possibly restructure) cljsbuilds #177

Open plexus opened 8 years ago

plexus commented 8 years ago

This came up after some questions on Clojurians Slack, there are some things which can be counterintuitive when using cljsbuild directly

The reason is it tries to compile all three builds (app, test, min), and the test build doesn't have doo.runner available, and so blows up.

This is solvable in the sense that it no longer explodes, just add doo as a dev dependency (and not just a plugin), but in a way it's actually good that lein cjlsbuild once blows up because both "app" and "min" target the same output file, so it's not clear what the result should be.

That is to say, it doesn't overwrite the output file, which it should do, so you end up with a non-optimized file when you want it optimized or vice versa. This is a thorny one because it can be a pain to figure out what's going on.

Possible solutions:

benzap commented 7 years ago

Another solution might be to incorporate some aliases within the project.clj, and document them in the README when dealing with production workflow

ie.

:aliases {"build-cljs" ["cljsbuild" "once" "min"]
             "build-garden" ["run" "-m" "garden-watcher.main" "website.styles"]
             "watch-cljs" ["cljsbuild" "auto" "app"]
             "test-cljs" ["do" ["cljsbuild" "once" "test"] ["doo"]] ;; bad example, super slow
             "build" ["do" ["build-cljs"] ["build-garden"]]}