Skip to content

Instantly share code, notes, and snippets.

@gmp26
Created August 9, 2016 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmp26/36088dbadaca074869ffdc1fc4016bef to your computer and use it in GitHub Desktop.
Save gmp26/36088dbadaca074869ffdc1fc4016bef to your computer and use it in GitHub Desktop.
(use 'figwheel-sidecar.repl-api)
(start-figwheel!) ;; <-- fetches configuration
(cljs-repl)
Figwheel: Starting server at http://0.0.0.0:3449
Figwheel: Watching build - dev
Figwheel: Cleaning build - dev
Compiling "resources/public/js/compiled/funnel.js" from ["src"]...
Successfully compiled "resources/public/js/compiled/funnel.js" in 1.391 seconds.
Figwheel: Starting CSS Watcher for paths ["resources/public/css"]
Launching ClojureScript REPL for build: dev
Figwheel Controls:
(stop-autobuild) ;; stops Figwheel autobuilder
(start-autobuild [id ...]) ;; starts autobuilder focused on optional ids
(switch-to-build id ...) ;; switches autobuilder to different build
(reset-autobuild) ;; stops, cleans, and starts autobuilder
(reload-config) ;; reloads build config and resets autobuild
(build-once [id ...]) ;; builds source one time
(clean-builds [id ..]) ;; deletes compiled cljs target files
(print-config [id ...]) ;; prints out build configurations
(fig-status) ;; displays current state of system
Switch REPL build focus:
:cljs/quit ;; allows you to switch REPL to another build
Docs: (doc function-name-here)
Exit: Control+C or :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application
To quit, type: :cljs/quit
cljs.user=> nil
--------------------
(defproject funnel "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:min-lein-version "2.6.1"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.8.51"]
[org.clojure/core.async "0.2.374"
:exclusions [org.clojure/tools.reader]]
[figwheel-sidecar "0.5.4-6"]
[rum "0.10.4"]
[proto-repl "0.3.1"]] ;; <-- added this
:plugins [
[lein-cljsbuild "1.1.3" :exclusions [[org.clojure/clojure]]]]
:source-paths ["src" "script"]
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
:cljsbuild {:builds
[{:id "dev"
:source-paths ["src"]
;; the presence of a :figwheel configuration here
;; will cause figwheel to inject the figwheel client
;; into your build
:figwheel {:on-jsload "funnel.core/on-js-reload"
;; :open-urls will pop open your application
;; in the default browser once Figwheel has
;; started and complied your application.
;; Comment this out once it no longer serves you.
:open-urls ["http://localhost:3449/index.html"]} ;; <-- this works
:compiler {:main funnel.core
:asset-path "js/compiled/out"
:output-to "resources/public/js/compiled/funnel.js"
:output-dir "resources/public/js/compiled/out"
:source-map-timestamp true}}
;; This next build is an compressed minified build for
;; production. You can build this with:
;; lein cljsbuild once min
{:id "min"
:source-paths ["src"]
:compiler {:output-to "../mywidget/inst/htmlwidgets/lib/square.js"
:main funnel.core
:optimizations :whitespace
:pretty-print true}}]}
:figwheel {;; :http-server-root "public" ;; default and assumes "resources"
;; :server-port 3449 ;; default
;; :server-ip "127.0.0.1"
:css-dirs ["resources/public/css"]} ;; watch and update CSS
;; Start an nREPL server into the running figwheel process
;; :nrepl-port 7888
;; Server Ring Handler (optional)
;; if you want to embed a ring handler into the figwheel http-kit
;; server, this is for simple ring servers, if this
;; doesn't work for you just run your own server :) (see lien-ring)
;; :ring-handler hello_world.server/handler
;; To be able to open files in your editor from the heads up display
;; you will need to put a script on your path.
;; that script will have to take a file path and a line number
;; ie. in ~/bin/myfile-opener
;; #! /bin/sh
;; emacsclient -n +$2 $1
;;
;; :open-file-command "myfile-opener"
;; if you are using emacsclient you can just use
;; :open-file-command "emacsclient"
;; if you want to disable the REPL
;; :repl false
;; to configure a different figwheel logfile path
;; :server-logfile "tmp/logs/figwheel-logfile.log"
;; setting up nREPL for Figwheel and ClojureScript dev
;; Please see:
;; https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl
:profiles {:dev {:dependencies [[figwheel-sidecar "0.5.4-7"]
[com.cemerick/piggieback "0.2.1"]]
;; need to add dev source path here to get user.clj loaded
:source-paths ["src" "dev"]
;; for CIDER
;; :plugins [[cider/cider-nrepl "0.12.0"]]
:repl-options {; for nREPL dev you really need to limit output
:init (set! *print-length* 50)
:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment