figwheel

general discussion about figwheel, specific discussions in #figwheel-main and #lein-figwheel
2018-04-16T01:25:44.000047Z

@bhauman After using shadow-cljs at work there is a really great small feature that I don't know if figwheel has. When the CLJS compile starts compiling it shows the loading indicator (the cljs logo in the bottom left). Would it be possible to do this in figwheel rather than just after a compile succeeds or fails? If this isn't clear I can post two gifs of the behavior

bhauman 2018-04-16T13:52:28.000716Z

@royalaid Yeah that is possible feature that will come out of the work I have been doing recently.

pez 2018-04-16T21:58:00.000464Z

Anyone succeeded in using deps.edn for figwheeling? I have tried porting the lein figwheel starter project. I get it to compile and wait for a connection. But I get the 404 message when trying to access the app from the browser.

pez 2018-04-16T21:59:09.000545Z

This is my build.clj.

(require ‘[cljs.build.api :as api]
         ‘[clojure.string :as string]
         ‘[figwheel-sidecar.repl-api :as figwheel]
         ’[figwheel-sidecar.components.nrepl-server :as figwheel.nrepl])

(def source-dir “src”)

(def compiler-config
  {:main          ’app.main
   :asset-path    “js/compiled/out”
   :output-to     “resources/public/js/compiled/app.js”
   :source-map    “resources/public/js/compiled/app.js.map”
   :output-dir    “resources/public/js/compiled/out”
   :optimizations :advanced})

(def dev-config
  (merge compiler-config
         {:optimizations :none
          :source-map    true}))

(def nrepl-options
  {:nrepl-port       7890
   :nrepl-middleware [“cider.nrepl/cider-middleware”
                      “cemerick.piggieback/wrap-cljs-repl”]})

(def ensure-nrepl-port! #(spit “.nrepl-port” (:nrepl-port nrepl-options)))

(def figwheel-options
  {:figwheel-options (merge nrepl-options
                            {:css-dirs [“resources/public/css”]})
   :all-builds       [{:id           “dev”
                       :figwheel     {:on-jsload “app.main/on-js-reload”}
                       :source-paths [source-dir “dev”]
                       :compiler     dev-config}]})

;;; Tasks --------------------------------------------------------------------------------

(defmulti task first)

(defmethod task :default [_]
  (task [“repl”]))

(defmethod task “compile” [_]
  (api/build source-dir compiler-config))

(defmethod task “repl” [_]
  (ensure-nrepl-port!)
  (figwheel.nrepl/start-nrepl-server nrepl-options nil)
  (println “Started nREPL server on port:” (:nrepl-port nrepl-options)))

(defmethod task “figwheel” [_]
  (ensure-nrepl-port!)
  (figwheel/start-figwheel! figwheel-options)
  (figwheel/cljs-repl))

(task *command-line-args*)

pez 2018-04-16T22:01:06.000138Z

My index.html is located in resources/public as should be where the figwheel server looks for it by default, I think. I’m pulling my hair!

pez 2018-04-16T22:05:21.000378Z

(Got the basic build script from this gist: https://gist.github.com/robert-stuttaford/b03de6eade713cea49c0411e6f817813 and then tried to merge it with the lein figwheel starter project.)