莱因·菲格比勒vs莱因cljsbuild自动 [英] lein figwheel vs lein cljsbuild auto

查看:165
本文介绍了莱因·菲格比勒vs莱因cljsbuild自动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

lein figwheel和lein cljsbuild auto有什么区别,因为我相信它们都可以用来编译clojurescript.

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?

推荐答案

Fighweel

它们都是lein插件,但Figwheel不仅将cljs编译为javascript,而且还具有热加载,该功能允许进行交互式编程,实际上Figwheel使用cljsbuild来编译cljs.

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.

您可以使用以下方法创建一个Figwheel应用程序:

You can create a figwheel app using:

lein new figwheel app

如果您运行:

lein figwheel

Figwheel会默认在端口3449上创建一个服务器进程,您可以将浏览器连接到localhost:3449,并且当您更改源代码时,您会看到Figwheel会编译代码并将新编译的javascript热加载到浏览器中(使用网络套接字).

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是一个插件,用于促进将cljs编译(或转换为javascript),它可以通过观察源文件中的更改来自动执行(auto),或者您可以使用once一次构建js,仅此而已.

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.

否则,如果没有cljsbuild,则应使用类似以下内容的

Otherwise without cljsbuild you should use something like:

java -cp cljs.jar:src clojure.main build.clj

其中cljs.jar是ClojureScript编译器,而build.clj是项目的构建配置.

Where cljs.jar is the ClojureScript compiler and build.clj is the build configuration for a project.

检查 ClojureScript入门页面,将为您提供有关构建过程如何工作的一些见解.

Check the ClojureScript getting started page, will give you some insight on how the building process works.

还要检查如何使用带LightTable的花式轮 ,这是一个很好的匹配,一种更高级的方法可以在emacs上使用CIDER,但一开始的配置可能很麻烦.

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.

使用一个相对于另一个还有什么好处?

它们是不同的工具,例如Fighweel wraps cljsbuild,所以我会尽可能使用Figwheel.

They are different tools, Fighweel wraps cljsbuild, so I would use Figwheel when I can.

这篇关于莱因·菲格比勒vs莱因cljsbuild自动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆