Permalink
Browse files

Add ClojureScript support.

  • Loading branch information...
1 parent c8e7ce0 commit e5ec280a5565082c52bcfcace836ba56fbcaf998 Mike Simpson committed Aug 11, 2012
View
3 project.clj
@@ -2,8 +2,9 @@
:description "FIXME: write this!"
:dependencies [[org.clojure/clojure "1.4.0"]
[noir "1.3.0-beta10"]
+ [noir-cljs "0.3.0"]
[com.datomic/datomic-free "0.8.3397"]
[org.clojars.pntblnk/clj-ldap "0.0.9"]]
:plugins [[lein-swank "1.4.4"]]
- :main shared-resource.server)
+ :main ^{:skip-aot true} shared-resource.server)
View
5 src/shared_resource/server.clj
@@ -1,11 +1,14 @@
(ns shared-resource.server
- (:require [noir.server :as server]))
+ (:require [noir.server :as server]
+ [noir.cljs.core]))
+(def cljs-options {:advanced {:externs ["externs/jquery.js"]}})
(server/load-views-ns 'shared-resource.views)
(defn -main [& m]
(let [mode (keyword (or (first m) :dev))
port (Integer. (get (System/getenv) "PORT" "8080"))]
+ (noir.cljs.core/start mode cljs-options)
(server/start port {:mode mode
:ns 'shared-resource})))
View
1 src/shared_resource/views/example.cljs
@@ -0,0 +1 @@
+(js/alert "hello")
View
3 src/shared_resource/views/resource.clj
@@ -9,6 +9,7 @@
;; Partials
+
(defpartial resource-list [
{:keys [
id
@@ -54,8 +55,8 @@
(resources-page (r/get-all)))
(defpage "/" []
+ (noir.cljs.core/include-scripts)
(resources-page (r/get-all)))
(defpage "/resources/:id" {:keys [id]}
(resource-page (r/get-by-id id)))
-

0 comments on commit e5ec280

Please sign in to comment.