Skip to content

Instantly share code, notes, and snippets.

@reedho
Created February 28, 2018 07:08
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 reedho/302fabea63ab3416200462e192c39827 to your computer and use it in GitHub Desktop.
Save reedho/302fabea63ab3416200462e192c39827 to your computer and use it in GitHub Desktop.
Using clojure cli with cljs browser repl, figwheel & cider nrepl
Run with:
clj -R:repl script.clj
Then connect emacs with `cider-connect`.
{:paths ["src" "resources"]
:deps {org.clojure/clojurescript {:mvn/version "LATEST"}}
:aliases
{:repl {:extra-deps
{
;; piggieback
com.cemerick/piggieback
{:mvn/version "0.2.2"
:exclusions [com.google.javascript/closure-compiler]}
;; figwheel-sidecar
figwheel-sidecar
{:mvn/version "0.5.14"
:exclusions [com.google.javascript/closure-compiler]}
;; CIDER compatible nREPL
cider/cider-nrepl {:mvn/version "0.15.1"}
org.clojure/tools.nrepl {:mvn/version "0.2.12"}
refactor-nrepl {:mvn/version "2.3.1"}}}}}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="main-area">
</div>
<script src="js/main.js" type="text/javascript"></script>
</body>
</html>
(require '[figwheel-sidecar.repl-api :as repl-api :refer [cljs-repl]])
(repl-api/start-figwheel!
{:figwheel-options {:server-port 5555
;;:http-server-root "public"
:nrepl-port 9090
:nrepl-middleware ["cider.nrepl/cider-middleware"
"refactor-nrepl.middleware/wrap-refactor"
"cemerick.piggieback/wrap-cljs-repl"]}
:all-builds [{:id "dev"
:figwheel true
:source-paths ["src"]
:compiler {:main 'clj2.core
:asset-path "js/out"
:output-to "resources/public/js/main.js"
:output-dir "resources/public/js/out"
:optimizations :none
:source-map true}
}]})
(cljs-repl)
(System/exit 0)
(ns clj2.core)
(print "Yay!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment