What is the difference between lein figwheel and lein cljsbuild auto because I believe that they are both used to compile clojurescript.
Also is there any benefit to using one over the other?
They are both lein plugins but Figwheel not only compiles cljs into javascript but it also features hot loading which allows interactive programming, actually Figwheel uses cljsbuild for compiling cljs.
You can create a figwheel app using:
lein new figwheel app
If you run:
lein figwheel
Figwheel will create a server process by default on port 3449, you can connect your browser to localhost:3449
and when you change your source code you'll see that Figwheel compiles the code and hotloads the new compiled javascript into your browser (using websockets).
Cljsbuild is a plugin for facilitating compiling (or transpiling) cljs into javascript, it can do automatically (auto
) by watching to changes in the source files or you can use once
to build js once, that's it.
Otherwise without cljsbuild you should use something like:
java -cp cljs.jar:src clojure.main build.clj
Where cljs.jar
is the ClojureScript compiler and build.clj
is the build configuration for a project.
Check the ClojureScript getting started page, will give you some insight on how the building process works.
Also check how to use Figwheel with LightTable, which is a nice match, a more advanced approach could be using CIDER on emacs, but the configuration can be cumbersome at first.
Also is there any benefit to using one over the other?
They are different tools, Fighweel wraps cljsbuild, so I would use Figwheel when I can.