Skip to content

Commit

Permalink
Use the correct options when building assets
Browse files Browse the repository at this point in the history
  • Loading branch information
pbiggar committed Jan 4, 2013
1 parent 8ac978c commit 6e32fce
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions dieter-core/src/dieter/core.clj
Expand Up @@ -30,19 +30,20 @@
(:content %)))
(cache/write-to-cache adrf))))

(defn asset-builder [app]
(defn asset-builder [app & [options]]
(fn [req]
(let [uri (-> req :uri)]
(if (path/is-asset-uri? uri)
(if-let [cached-filename (-> uri
path/uri->adrf
path/uncachify-path
find-and-cache-asset)]
(let [new-uri (path/make-relative-to-cache cached-filename)]
(cache/add-cached-uri uri new-uri)
(app (assoc req :uri new-uri)))
(app req))
(app req)))))
(settings/with-options options
(let [uri (-> req :uri)]
(if (path/is-asset-uri? uri)
(if-let [cached-filename (-> uri
path/uri->adrf
path/uncachify-path
find-and-cache-asset)]
(let [new-uri (path/make-relative-to-cache cached-filename)]
(cache/add-cached-uri uri new-uri)
(app (assoc req :uri new-uri)))
(app req))
(app req))))))

;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Entry points
Expand All @@ -64,13 +65,13 @@
(if (settings/production?)
(-> app
(wrap-file (settings/cache-root))
(asset-builder)
(asset-builder options)
(wrap-file-expires-never (settings/cache-root))
(wrap-file-info known-mime-types)
(wrap-dieter-mime-types))
(-> app
(wrap-file (settings/cache-root))
(asset-builder)
(asset-builder options)
(wrap-file-info known-mime-types)
(wrap-dieter-mime-types)
(wrap-file-info known-mime-types)))))
Expand Down

0 comments on commit 6e32fce

Please sign in to comment.