0
我一直在命令行試圖獲取ClojureScript運行$ lein cljsbuild auto
。但不斷髮出警告無法找到交叉:web-viz.x-over。交叉線是在下面設置ClojureScript
(defproject web-viz
:dependencies [[org.clojure/clojure "1.4.0"]
[ring/ring-core "1.1.7"]
[ring/ring-jetty-adapter "1.1.7"]
[compojure "1.1.3"]
[hiccup "1.0.2"]]
:plugins [[lein-ring "0.8.3"]
[lein-cljsbuild "0.2.10"]]
:ring {:handler web-viz.web/app}
:cljsbuild {:crossovers [web-viz.x-over],
:builds [{:source-paths ["src-cljs"],
:crossover-path "xover-cljs",
:compiler
{:pretty-print true,
:output-to "resources/js/script.js",
:optimizations :whitespace}}]})
我的項目最終,我試圖啓動並看到:
以下目錄已作出:
$ mkdir -p src-cljs/webviz
$ mkdir -p resources/js
的還創建了以下文件src-cljs/webviz/core.cljs
包含
(ns webviz.core)
(defn ^:export hello [world]
(js/alert (str "Hello, " world)))
和我包含
(defn index-page []
(html5
[:head
[:title "Web Charts"]]
[:body
[:h1 {:id "web-charts"} "Web Charts"]
[:ol
[:li [:a {:href "/data/census-race.json"} "2010 Census Race Data"]]]
(include-js "js/script.js")
(javascript-tag "webviz.core.hello('from ClojureScript!');")]))
(defroutes site-routes
(GET "/" [] (index-page))
(route/resources "/")
(route/not-found "Page not found"))
(def app (-> (handler/site site-routes)))