Skip to content

Commit

Permalink
Strip the cljsjs/{development,production,common,etc} dirs when dumpin…
Browse files Browse the repository at this point in the history
…g into fileset

- Some tools get confused (google closure compiler, for example) when
  there is a file in a jar and in a directory on the class path with the
  same resource path. This commit addresses that issue.

- Also, when we use other resources like images etc, it's important that
  their paths relative to the HTML file are preserved, because css or js
  might reference them. Tools like the boot cljs task will install
  relevant files from cljsjs in the correct place, so we don't need to
  make special modifications to the css or js in most cases (only when
  they rely on absolute paths, which is terrible practice, anyway).
  • Loading branch information
micha committed Jan 17, 2015
1 parent 350305f commit f277193
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions build.boot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(set-env!
:source-paths #{"src"}
:dependencies '[[adzerk/bootlaces "0.1.8" :scope "test"]])
:dependencies '[[adzerk/bootlaces "0.1.9" :scope "test"]])

(require '[adzerk.bootlaces :refer :all])

Expand All @@ -15,5 +15,4 @@
libraries for Clojurescript projects"
:url "https://github.com/cljsjs/boot-cljsjs"
:scm {:url "https://github.com/cljsjs/boot-cljsjs"}
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}})
:license {"Eclipse Public License" "http://www.eclipse.org/legal/epl-v10.html"}})
7 changes: 4 additions & 3 deletions src/cljsjs/boot_cljsjs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
(let [env (c/get-env)
markers ["cljsjs/common/" (str "cljsjs/" (name profile) "/")]
files (jars/cljs-dep-files env markers [])
paths (map #(.replaceAll % "^cljsjs/[^/]+/" "") files)
dep-order (-> (fn [xs [n p]]
(assoc xs p {:dependency-order n}))
(reduce {} (map-indexed list files)))]
(reduce {} (map-indexed list paths)))]
;(prn :deps dep-order)
(doseq [f files]
(copy-file tmp f f))
(doseq [[f p] (map list files paths)]
(copy-file tmp f p))
(reset! filemeta dep-order)))
(-> fileset (c/add-source tmp) (c/add-meta @filemeta) c/commit!))))

Expand Down

0 comments on commit f277193

Please sign in to comment.