Skip to content

Instantly share code, notes, and snippets.

@alvinfrancis
Created August 27, 2014 03:33
Show Gist options
  • Save alvinfrancis/3014bfcf53378450d8c0 to your computer and use it in GitHub Desktop.
Save alvinfrancis/3014bfcf53378450d8c0 to your computer and use it in GitHub Desktop.
Clojurescript dev profile for browser-repl with Austin
{:shared {:clean-targets ["out" :target-path]}
:dev [:shared
{:resources-paths ["dev-resources"]
:source-paths ["dev-resources/tools/repl"]
:plugins [[com.cemerick/austin "0.1.4"]]
:injections [(require 'cemerick.austin.repls)
(defn browser-repl-env []
(reset! cemerick.austin.repls/browser-repl-env
(cemerick.austin/repl-env)))
(defn browser-repl []
(cemerick.austin.repls/cljs-repl (browser-repl-env))
(println (cemerick.austin.repls/browser-connected-repl-js)))]}]}
@alvinfrancis
Copy link
Author

Use with Emacs Cider:
cider-jack-in on an open Clojurescript file. Run (browser-repl) in the open cider repl. The printed value must be run in a target HTML document (e.g. add <script> tags to the end of the document containing the value. (browser-repl) will leave the repl in a Clojurescript repl attached to any open browser that has run the prior generated value.

This is a bare minimum necessary to easily take advantage of Austin's browser repl. Ideally, however, it's better to serve the documents using Clojure (Ring, Compojure), to easily allow generating the value of (cemerick.austin.repls/browser-connected-repl-js) as part of a served HTML file by using templating libraries (Enlive, Hickory).

@alvinfrancis
Copy link
Author

NOTE (to self): Use Weasel instead of austin. This profile is deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment