Skip to content

Commit

Permalink
Read existing compiled js rather than recompiling.
Browse files Browse the repository at this point in the history
  • Loading branch information
brentonashworth committed Jul 12, 2011
1 parent 82c5762 commit d53bd9b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/clj/cljs/closure.clj
Expand Up @@ -405,10 +405,14 @@ the JAR file."
(let [file (str (string/replace ns "." "/") ".cljs")
js-file (comp/rename-to-js file)
out-file (io/file (output-directory opts) js-file)
javascript (if (and (.exists out-file) (get @compiled-cljs ns))
(get @compiled-cljs ns)
(-compile (io/resource file)
(merge opts {:output-file js-file})))]
javascript (cond (and (.exists out-file) (get @compiled-cljs ns)) (get @compiled-cljs ns)
(.exists out-file) (let [ns-info (parse-js-ns
(string/split-lines (slurp out-file)))]
(javascript-file (to-url out-file)
(:provides ns-info)
(:requries ns-info)))
:else (-compile (io/resource file)
(merge opts {:output-file js-file})))]
(do (swap! compiled-cljs (fn [old] (assoc old ns javascript)))
javascript)))

Expand Down

0 comments on commit d53bd9b

Please sign in to comment.