update the way JtwigTemplates are created so the JtwigConfiguration object can be passed in for each case
This commit is contained in:
parent
159918019a
commit
5a644a92d2
|
@ -5,7 +5,7 @@
|
||||||
(com.lyncode.jtwig.configuration JtwigConfiguration)
|
(com.lyncode.jtwig.configuration JtwigConfiguration)
|
||||||
(com.lyncode.jtwig.render RenderContext)
|
(com.lyncode.jtwig.render RenderContext)
|
||||||
(com.lyncode.jtwig.render.config RenderConfiguration)
|
(com.lyncode.jtwig.render.config RenderConfiguration)
|
||||||
(com.lyncode.jtwig.resource ClasspathJtwigResource)
|
(com.lyncode.jtwig.resource ClasspathJtwigResource StringJtwigResource FileJtwigResource)
|
||||||
(java.io File FileNotFoundException ByteArrayOutputStream)
|
(java.io File FileNotFoundException ByteArrayOutputStream)
|
||||||
(java.net URL))
|
(java.net URL))
|
||||||
(:require [clojure.walk :refer [stringify-keys]])
|
(:require [clojure.walk :refer [stringify-keys]])
|
||||||
|
@ -41,19 +41,21 @@
|
||||||
(defonce compiled-templates (atom {}))
|
(defonce compiled-templates (atom {}))
|
||||||
|
|
||||||
(defn- compile-template-string [^String contents]
|
(defn- compile-template-string [^String contents]
|
||||||
(->> contents
|
(-> contents
|
||||||
(new JtwigTemplate)
|
(StringJtwigResource.)
|
||||||
|
(JtwigTemplate. configuration)
|
||||||
(.compile)))
|
(.compile)))
|
||||||
|
|
||||||
(defn- compile-template-file [^File file]
|
(defn- compile-template-file [^File file]
|
||||||
(if (inside-jar? file)
|
(if (inside-jar? file)
|
||||||
(->> (.getPath file)
|
(-> (.getPath file)
|
||||||
(get-jar-resource-filename)
|
(get-jar-resource-filename)
|
||||||
(new ClasspathJtwigResource)
|
(ClasspathJtwigResource.)
|
||||||
(new JtwigTemplate)
|
(JtwigTemplate. configuration)
|
||||||
(.compile))
|
(.compile))
|
||||||
(->> file
|
(-> file
|
||||||
(new JtwigTemplate)
|
(FileJtwigResource.)
|
||||||
|
(JtwigTemplate. configuration)
|
||||||
(.compile))))
|
(.compile))))
|
||||||
|
|
||||||
(defn- newer? [^File file other-timestamp]
|
(defn- newer? [^File file other-timestamp]
|
||||||
|
|
Reference in a new issue