Skip to content

Instantly share code, notes, and snippets.

@Cartmanishere
Created July 23, 2021 12:32
Show Gist options
  • Save Cartmanishere/8611a6750bf8e3f17478d0d4feb6a74c to your computer and use it in GitHub Desktop.
Save Cartmanishere/8611a6750bf8e3f17478d0d4feb6a74c to your computer and use it in GitHub Desktop.
(ns ...
(:import [com.github.jknack.handlebars.io TemplateLoader URLTemplateSource]
[java.net URL]))
(defn http-loader-reify
[base-url]
(reify TemplateLoader
(resolve [this filename]
(str base-url filename (. this getSuffix)))
(sourceAt [this uri]
(let [location (. this resolve uri)]
(URLTemplateSource. location (URL. location))))
(getSuffix [this]
".hbs")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment