Fork me on GitHub
#figwheel
<
2018-04-16
>
royalaid01:04:44

@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

bhauman13:04:28

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

pez21:04:00

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.

pez21:04:09

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*)

pez22:04:06

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!

pez22:04:21

(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.)