Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add hook to run cljx before `lein jar`.

  • Loading branch information...
commit 7a32c50d757fcea5518d8497c3da7579a59a2c74 1 parent 8be8be1
Kevin Lynagh authored
2  .gitignore
... ... @@ -1,3 +1,5 @@
1 1 lib/
2 2 .lein*
3 3 test/generated
  4 +pom.xml
  5 +target/
15 README.markdown
Source Rendered
@@ -27,6 +27,14 @@ To use it, add it to your `project.clj`:
27 27 :rules cljx.rules/cljs-rules}]}
28 28 ```
29 29
  30 +Add
  31 +
  32 +```clojure
  33 +:hooks [cljx.hooks]
  34 +```
  35 +
  36 +to automatically run cljx before cutting a JAR.
  37 +
30 38 The included clj and cljs rule sets will remove forms marked with platform-specific metadata and rename protocols as appropriate.
31 39 E.g., the `.cljx` source containing
32 40
@@ -89,10 +97,3 @@ Misc
89 97 ----
90 98 Emacs users, want syntax highlighting?
91 99 Add to your emacs config: `(add-to-list 'auto-mode-alist '("\\.cljx\\'" . clojure-mode))`.
92   -
93   -
94   -
95   -Todo
96   -----
97   -
98   -+ Hook into cljsbuild + jar processes
11 src/cljx/hooks.clj
... ... @@ -0,0 +1,11 @@
  1 +(ns cljx.hooks
  2 + (:require leiningen.cljx
  3 + [robert.hooke :as hooke]
  4 + [leiningen.jar :as ljar]))
  5 +
  6 +(defn- jar-hook [task project]
  7 + (leiningen.cljx/cljx project)
  8 + (task project))
  9 +
  10 +(defn activate []
  11 + (hooke/add-hook #'ljar/jar #'jar-hook))
2  src/leiningen/cljx.clj
@@ -10,7 +10,7 @@
10 10
11 11 (defn cljx
12 12 "Statically transform .cljx files into Clojure and ClojureScript sources."
13   - [project & args]
  13 + [project]
14 14
15 15 (if-let [opts (:cljx project)]
16 16 (if-let [{builds :builds} opts]

0 comments on commit 7a32c50

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