Skip to content
Browse files

Add hook to run cljx before `lein jar`.

  • Loading branch information...
1 parent 8be8be1 commit 7a32c50d757fcea5518d8497c3da7579a59a2c74 @lynaghk committed Apr 1, 2012
Showing with 22 additions and 8 deletions.
  1. +2 −0 .gitignore
  2. +8 −7 README.markdown
  3. +11 −0 src/cljx/hooks.clj
  4. +1 −1 src/leiningen/cljx.clj
View
2 .gitignore
@@ -1,3 +1,5 @@
lib/
.lein*
test/generated
+pom.xml
+target/
View
15 README.markdown
@@ -27,6 +27,14 @@ To use it, add it to your `project.clj`:
:rules cljx.rules/cljs-rules}]}
```
+Add
+
+```clojure
+:hooks [cljx.hooks]
+```
+
+to automatically run cljx before cutting a JAR.
+
The included clj and cljs rule sets will remove forms marked with platform-specific metadata and rename protocols as appropriate.
E.g., the `.cljx` source containing
@@ -89,10 +97,3 @@ Misc
----
Emacs users, want syntax highlighting?
Add to your emacs config: `(add-to-list 'auto-mode-alist '("\\.cljx\\'" . clojure-mode))`.
-
-
-
-Todo
-----
-
-+ Hook into cljsbuild + jar processes
View
11 src/cljx/hooks.clj
@@ -0,0 +1,11 @@
+(ns cljx.hooks
+ (:require leiningen.cljx
+ [robert.hooke :as hooke]
+ [leiningen.jar :as ljar]))
+
+(defn- jar-hook [task project]
+ (leiningen.cljx/cljx project)
+ (task project))
+
+(defn activate []
+ (hooke/add-hook #'ljar/jar #'jar-hook))
View
2 src/leiningen/cljx.clj
@@ -10,7 +10,7 @@
(defn cljx
"Statically transform .cljx files into Clojure and ClojureScript sources."
- [project & args]
+ [project]
(if-let [opts (:cljx project)]
(if-let [{builds :builds} opts]

0 comments on commit 7a32c50

Please sign in to comment.
Something went wrong with that request. Please try again.