lein figwheel vs lein cljsbuild auto

安稳与你 提交于 2019-12-07 05:42:36

问题


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?


回答1:


Fighweel

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

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.

Info

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.



来源:https://stackoverflow.com/questions/40738366/lein-figwheel-vs-lein-cljsbuild-auto

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!