Created
February 14, 2021 12:36
-
-
Save Cartmanishere/b199a92256a2a1c649f3e0a203d621d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Util to convert Clojure map to Java Hashmap | |
(defn clj-map->java-map | |
[data] | |
(postwalk | |
#(cond | |
(map? %) (java.util.HashMap. ^java.util.Map %) | |
(keyword? %) (name %) | |
:else %) | |
data)) | |
;; Initialize the http loader | |
(def loader (http-loader "https://bucket-name.s3.Region.amazonaws.com/")) | |
;; Initialize the Handlebars object with custom loader | |
(def hbs (Handlebars. loader)) | |
;; Render a `index.hbs` file with some data | |
(-> (.compile hbs "index") | |
(.apply (clj-map->java-map {:title "This is title"}))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment