Selmer icon indicating copy to clipboard operation
Selmer copied to clipboard

RFE: add cljs support

Open green-coder opened this issue 6 years ago • 3 comments
trafficstars

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?

green-coder avatar Jan 11 '19 19:01 green-coder

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.

yogthos avatar Jan 11 '19 21:01 yogthos

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.

borkdude avatar May 07 '21 16:05 borkdude

I was just thinking about this as well, and there's a goog.string.StringBuffer that would be useful here.

yogthos avatar May 07 '21 18:05 yogthos