add get-compiled-template function
eventually this will handle fetching pre-compiled templates out of the cache, but for now this will help us refactor everything else to use this instead and work with compiled template objects instead elsewhere
This commit is contained in:
parent
0ad83ccb51
commit
feefe82a30
|
@ -13,6 +13,13 @@
|
|||
; be rendered by calling it's 'render' method
|
||||
(defonce compiled-templates (atom {}))
|
||||
|
||||
(defn- get-compiled-template [file]
|
||||
(if-not (.exists file)
|
||||
(throw (new FileNotFoundException (str "Template file \"" file "\" not found.")))
|
||||
(->> file
|
||||
(new JtwigTemplate)
|
||||
(.compile))))
|
||||
|
||||
(defn- create-function-repository []
|
||||
(new DefaultFunctionRepository (make-array JtwigFunction 0)))
|
||||
|
||||
|
|
Reference in a new issue