ckirkendall / kioo

Enlive/Enfocus style templating for Facebook's React and Om in ClojureScript.
Eclipse Public License 1.0
404 stars 39 forks source link

Allow templates from sources other than classpath resources #51

Closed levand closed 9 years ago

levand commented 9 years ago

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+.

levand commented 9 years ago

Thanks!