【问题标题】:How to show generated JS in Clojurescript REPL?如何在 Clojurescript REPL 中显示生成的 JS?
【发布时间】:2014-01-09 09:46:38
【问题描述】:
【问题讨论】:
标签:
javascript
emacs
read-eval-print-loop
clojurescript
【解决方案1】:
如果您在启用 BREPL 的情况下评估 emacs-cider 到 C-c C-e nrepl-eval-last-expression 中的 clojure[script] 代码,您将获得相同的效果。
你也可以为这个https://github.com/halgari/clojure-conj-2013-core.async-examples重用相同的代码
注意你必须先加载这个指令
(require 'cljs.repl.browser)
(cemerick.piggieback/cljs-repl
:repl-env (cljs.repl.browser/repl-env :port 9000))
然后重新加载浏览器并尝试此操作以确认您已连接
(js/alert "We're running ClojureScript")
您的浏览器中会出现警报
这是 Timothy Baldridge Conference 的 project.clj 定义
(defproject clojure-conj-talk "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:plugins [[lein-cljsbuild "1.0.0-alpha2"]]
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/core.async "0.1.256.0-1bf8cf-alpha"]
[http-kit "2.1.10"]
[cheshire "5.2.0"]
[org.clojure/clojurescript "0.0-2014"]
[com.cemerick/austin "0.1.3"]]
:profiles {:dev {:repl-options {:init-ns user}
:plugins [[com.cemerick/austin "0.1.0"]
[lein-cljsbuild "0.3.2"]]
:cljsbuild {:builds [{:source-paths ["src-cljs"]
:compiler {:output-to "app.js"
:optimizations :simple
:pretty-print true}}]}}})