Difference between figwheel and (watch and reload)

243 views Asked by At

I am trying to learn clojurescript by building a desktop application. The boot configuration I am working with as follows:

(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"})))

I am willing to add a task to run figwheel. But before doing that I wanted to know whats the difference between using figwheel and (watch and reload) functions as described in dev task?

1

There are 1 answers

0
Daniel Compton On BEST ANSWER

Here's some quotes about the differences between the two:

figwheel -> https://github.com/adzerk-oss/boot-reload It's not as smart as figwheel because u can lose state, but it's mostly enough. We are actually quite fine with reloading the page manually most of the time.

 

Figwheel has more bells and whistles but the core functionality should be very similar -- martinklepsch

 

Figwheel at it's core is the same as what boot-reload can do for you if you develop a Hoplon app