A component for running Figwheel
Clojure HTML CSS
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
dev Replace Figwheel REPL call with custom function Oct 28, 2015
README.md Release 0.3.3 Oct 1, 2016
project.clj Release 0.3.3 Oct 1, 2016



A component for the Figwheel development tool, designed to be used in the Duct framework (but can be used in any component-based system).


Add the following dependency to your project.clj:

[duct/figwheel-component "0.3.3"]


Require the library and the Component library:

(require '[duct.component.figwheel :as figwheel]
         '[com.stuartsierra.component :as component])

Setup the component with a Figwheel-compatible configuration:

(def figwheel
   {:css-dirs ["resources/public/css"]
    [{:source-paths ["src/cljs"]
      {:output-to "target/figwheel/public/main.js"
       :output-dir "target/figwheel/public"
       :optimizations :none}}]}))

Start the server:

(alter-var-root #'figwheel component/start)

Ensure that the client ClojureScript starts Figwheel as well:

(figwheel.client/start {:websocket-url "ws://localhost:3449/figwheel-ws"})

Unlike the Leiningen plugin of Figwheel, this component does not trigger builds automatically. Instead, you have the following functions at the REPL:

(figwheel/build-cljs figwheel)    ;; build modified cljs files
(figwheel/rebuild-cljs figwheel)  ;; build all cljs files
(figwheel/refresh-css figwheel)   ;; refresh CSS files

Running any of those functions will cause the updated code to be pushed over websocket to any open clients.

You can also start a Piggieback REPL over the Figwheel connection:

(figwheel/cljs-repl figwheel)           ;; uses first build
(figwheel/cljs-repl figwheel build-id)  ;; uses specific build-id

This REPL will allow you to evaluate ClojureScript on the browser.

To stop the server:

(alter-var-root #'figwheel component/stop)


Copyright © 2016 James Reeves

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.