图轮与(观看和重新加载)之间的区别

时间:2017-09-19 01:33:44

标签: clojurescript figwheel

我正在尝试通过构建桌面应用程序来学习clojurescript。我正在使用的启动配置如下:

(def +name+ "visivo/desktop")
(def +version+ "0.0.1-SNAPSHOPT")
(def +description+ "Desktop application for visivo")
(def +repository+ "https://gitlab.com/visivo/desktop")

(set-env!
  :source-paths   #{"src/cljs"}
  :resource-paths #{"resources"}
  :dependencies '[
                  [org.clojure/clojure "1.9.0-alpha20"]
                  [org.clojure/clojurescript "1.9.908"]
                  [org.clojure/tools.nrepl "0.2.12" :scope "test"]
                  [com.cemerick/piggieback "0.2.2"  :scope "test"]
                  [weasel "0.7.0" :scope "test"]
                  [adzerk/boot-cljs "2.1.3" :scope "test"]
                  [adzerk/boot-cljs-repl "0.3.3" :scope "test"]
                  [adzerk/boot-reload "0.5.2" :scope "test"]
                  [proto-repl "0.3.1" :scope "test"]
                  [proto-repl-charts "0.3.2" :scope "test"]
                  [boot-codox "0.10.3" :scope "test"]])

(require
 '[adzerk.boot-cljs      :refer [cljs]]
 '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]]
 '[adzerk.boot-reload    :refer [reload]]
 '[codox.boot            :refer [codox]])

(task-options!
 pom {:project     'visivo/desktop
      :version     +version+
      :description +description+
      :url         +repository+
      :scm         {:url +repository+}
      :license     {"Eclipse Public License"
                    "http://www.eclipse.org/legal/epl-v10.html"}})
(deftask prod []
  (comp (cljs :ids #{"main"}
              :optimizations :advanced)
        (cljs :ids #{"renderer"}
              :optimizations :advanced)))

(deftask dev []
  (comp
        (speak)
        (watch)
        (cljs-repl :ids #{"renderer"})
        (reload    :ids #{"renderer"}
                   :ws-host "localhost"
                   :on-jsload 'visivo.renderer/init
                   :target-path "target")
        (cljs      :ids #{"renderer"})
        (cljs      :ids #{"main"}
                   :compiler-options {:asset-path "target/main.out"
                                      :closure-defines {'visivo.main/dev? true}})
        (target)))

(deftask docs []
  "Generates documentation for the project from comments"
  (comp (codox
          :name +name+
          :description +description+
          :version +version+
          :language :clojurescript
          :output-path ".")
        (target :dir #{"docs"})))

我愿意添加一个运行figwheel的任务。但在此之前,我想了解使用figwheel和(监视和重新加载)函数之间的区别,如dev任务中所述?

1 个答案:

答案 0 :(得分:3)

以下是关于两者之间差异的quotes

  

figwheel - > https://github.com/adzerk-oss/boot-reload它不像figwheel那么聪明,因为你可以失去状态,但它足够了。实际上,我们在大多数情况下手动重新加载页面非常好。

  

Figwheel有更多的铃声和口哨但核心功能应该非常相似 - martinklepsch

  

如果您开发Hoplon应用程序,它的核心就像启动重载可以为您做的那样