Selmer
Selmer copied to clipboard
RFE: add cljs support
This is a open feature request to have Selmer run in cljs so that it could be used in the browser.
@yogthos If someone (maybe me in a hypothetical future) make a PR, would you accept it? Is there anything the contributor would need to know before starting?
Hi,
I've thought about making Selemer cljc before, and it should be possible to make most of the functionality cross-platform. One thing to watch out for would be that the parser does a lot of character manipulation using the StringBuilder class. I think that goog.string.StringBuffer. should provide sufficient functionality in cljs, but I haven't investigated that much. It would probably make sense to omit template inheritance on the client as well which reduces the scope of work involved.
My main concern in terms of a PR would be around maintainability. Ideally, it would be nice to keep as much of existing code unchanged as possible, and factor out platform specific code, such as instantiation of the StringBuilder into its separate namespaces that would provide platform agnostic API.
Now that all dependencies are optional and Selmer is "pure" Clojure, adding .cljc support would probably be easier. I'm pretty sure everything that Selmer does is possible in CLJS since clojure.tools.reader also works in CLJS and it does similar things with strings, readers and buffers.
I was just thinking about this as well, and there's a goog.string.StringBuffer that would be useful here.