Reputation: 1057
I have been trying the following in the command line to get ClojureScript running $ lein cljsbuild auto
. But keep getting a warning unable to find crossover: web-viz.x-over. The crossover line is in my project below
(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}}]})
Ultimately, I am trying to launch and see this:
The following directories have been made:
$ mkdir -p src-cljs/webviz
$ mkdir -p resources/js
The following file was also created src-cljs/webviz/core.cljs
containing
(ns webviz.core)
(defn ^:export hello [world]
(js/alert (str "Hello, " world)))
and my web.clj
contains
(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)))
Upvotes: 0
Views: 189
Reputation: 166
You are using a really outdated tutorial. According to Leiningen docs, crossovers are deprecated. Moreover, you only need them if you intend to share code between backend/frontend, which I doubt you do.
The simplest starting point for a ClojureScript project that I know of is:
$ lein new mies webviz && cd webviz
$ lein cljsbuild once
$ open index.html
Which will present you a blank page, and a "Hello world!" in javascript console.
Upvotes: 1