Browse files

Expose create-css-asset for use in transpilers

  • Loading branch information...
1 parent e25b54a commit 8191a7c030caad7f737e187f1e391a636cc66d90 @magnars committed Dec 30, 2013
Showing with 8 additions and 6 deletions.
  1. +8 −6 src/optimus/assets/load_css.clj
View
14 src/optimus/assets/load_css.clj
@@ -37,18 +37,20 @@
match
(css-url-str (replacement-fn file url)))))))
-(defn paths-in-css [file]
+(defn- paths-in-css [file]
(->> file :contents
(re-seq css-url-re)
(map second)
(remove data-url?)
(remove external-url?)
(map #(combine-paths (original-path file) %))))
-(defn load-css-asset [public-dir path]
- (let [resource (existing-resource public-dir path)
- contents (slurp resource)
- asset (-> (create-asset path contents
- :last-modified (last-modified resource))
+(defn create-css-asset [path contents last-modified]
+ (let [asset (-> (create-asset path contents
+ :last-modified last-modified)
(replace-css-urls #(combine-paths (original-path %1) %2)))]
(assoc asset :references (set (paths-in-css asset)))))
+
+(defn load-css-asset [public-dir path]
+ (let [resource (existing-resource public-dir path)]
+ (create-css-asset path (slurp resource) (last-modified resource))))

0 comments on commit 8191a7c

Please sign in to comment.