Skip to content

Commit

Permalink
CLJS-683: :source-map-path option
Browse files Browse the repository at this point in the history
Source map paths to source files can now be made relative to anything
making integration with web work flows simpler.
  • Loading branch information
swannodette committed Nov 17, 2013
1 parent cc6a729 commit aceafe1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/clj/cljs/closure.clj
Expand Up @@ -762,6 +762,7 @@
{:lines (+ (:lineCount sm-json) 2)
:file (:file sm-json)
:output-dir (output-directory opts)
:source-map-path (:source-map-path opts)
:relpaths relpaths}))))))
source)
(report-failure result))))
Expand Down
6 changes: 3 additions & 3 deletions src/clj/cljs/source_map.clj
Expand Up @@ -152,13 +152,13 @@
[] cols)))
[] lines)))

(defn relativize-path [path {:keys [output-dir relpaths]}]
(defn relativize-path [path {:keys [output-dir source-map-path relpaths]}]
(cond
(re-find #"\.jar!/" path)
(str output-dir (second (string/split path #"\.jar!")))
(str (or source-map-path output-dir) (second (string/split path #"\.jar!")))

:else
(str output-dir "/" (get relpaths path))))
(str (or source-map-path output-dir) "/" (get relpaths path))))

(defn encode
"Take an internal source map representation represented as nested
Expand Down

0 comments on commit aceafe1

Please sign in to comment.