 (ns continuo.util.template
   "A lightweight abstraction over mustache.java
   template engine."
-  (:require [clojure.walk :as walk])
+  (:require [clojure.walk :as walk]
+            [clojure.java.io :as io])
   (:import java.io.StringReader
            java.io.StringWriter
            java.util.HashMap

  ([^String template context]
   (let [reader (StringReader. template)
         template (.compile +mustache-factory+ reader "example")]
     (render template context))))

(defn render-resource
  "Load a file from the class path and render
  it using mustache template."
  ([^String path]
   (render-resource path {}))
  ([^String path context]
   (let [template (.compile +mustache-factory+ path)]
     (render template context))))

  ^DefaultMustacheFactory
  +mustache-factory+ (DefaultMustacheFactory.))

(defn- render*
  [^Mustache template context]
  (with-out-str
    (let [scope (HashMap. (walk/stringify-keys context))]
