Sometimes it is useful to load a template from a location other than a classpath resource. This might be an external URL, or a file on the file system that is not on the classpath (for whatever reason.)
In my particular use case, I am loading templates from a local Middleman development server, where designers can write markup directly with the full suite of Ruby tools which can then get dynamically pulled into my Clojurescript at CLJS compile time.
The only substantive changes is to call eval on the path form. If it is a string, it evaluates to a string and everything works exactly the way it did. Otherwise, it may be any form which, when evaluated in Clojure, will return an object that can be passed to net.cgrand.enlive-html/get-resource, which includes URLs, Files, Readers, etc.
The only other changes in this PR are minor, minimal changes to get it working with React 13+.
Sometimes it is useful to load a template from a location other than a classpath resource. This might be an external URL, or a file on the file system that is not on the classpath (for whatever reason.)
In my particular use case, I am loading templates from a local Middleman development server, where designers can write markup directly with the full suite of Ruby tools which can then get dynamically pulled into my Clojurescript at CLJS compile time.
The only substantive changes is to call
eval
on thepath
form. If it is a string, it evaluates to a string and everything works exactly the way it did. Otherwise, it may be any form which, when evaluated in Clojure, will return an object that can be passed tonet.cgrand.enlive-html/get-resource
, which includes URLs, Files, Readers, etc.The only other changes in this PR are minor, minimal changes to get it working with React 13+.