我使用catnip/leiningen试图学习Clojure ...所以我有一个简单的网站,现在我想在我的页面中添加一个clojure脚本。从html访问clojurescript
所以我拿了一个简单的例子,但现在被困在如何从我的网站访问我的脚本。
我project.clj
(defproject hello-world "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.4.0"]
[compojure "1.1.5"]
[hiccup "1.0.2"]]
:plugins [[lein-ring "0.8.2"]]
:cljsbuild {:builds
[{:source-path "src"
:compiler
{:output-to "resources/public/cljs/main.js"
:output-dir "resources/public/cljs"
:optimizations :simple
:pretty-print true}}]}
:ring {:handler hello-world.handler/app}
:profiles
{:dev {:dependencies [[ring-mock "0.1.3"]]}})
handler.clj
(defn header [title]
(html
[:head
[:title title]
[:script "/cljs/play.js"]]))
的有关部分。如果我跑雷音环服务器在http://localhost:8080/resources/public/cljs/main.js
有什么。如何映射js的请求,以便我的网站可以找到它们?
问题出在[:script] -tag。我用(include-js“/cljs/main.js”)取代了它并开始工作。所以我的代码不好... – Roland 2013-02-13 13:19:10
@Roland True。你也可以使用'[:script {:src“/cljs/main.js”}]' – ponzao 2013-02-13 13:27:37
更新你的答案,以便我可以将它设置为一个很好的答案:-) – Roland 2013-02-13 15:31:31