Created
January 18, 2015 21:09
-
-
Save micha/9f573a00895133562f45 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn externs | |
| "Middleware to add externs files (i.e. files with the .ext.js extension) and | |
| Google Closure libs (i.e. files with the .lib.js extension) from the fileset | |
| to the CLJS compiler options." | |
| [{:keys [tmp-src tmp-out main files opts] :as ctx}] | |
| (let [ext-paths (map core/tmppath (:exts files)) | |
| lib-ins (map core/tmpfile (:libs files)) | |
| renamelib #(.replaceAll % "\\.lib\\.js$" ".js") | |
| merge-cfg (partial merge-with (comp vec distinct into)) | |
| lib-paths (->> (map (comp renamelib core/tmppath) (:libs files)) | |
| (map #(.getPath (io/file tmp-out %))))] | |
| (doseq [[in out] (map list lib-ins lib-paths)] | |
| (file/copy-with-lastmod (io/file in) (io/file out))) | |
| (update-in ctx [:opts] merge-cfg {:libs lib-paths :externs ext-paths}))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment