我使用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