I decided last night that I should force ClojureScript and Ember to get to know each other.
I found it amusing, and pretty fun to set up, so I thought I’d share.
Being fairly new to ClojureScript, I’m sure this is lacking in idioms. On the other hand, there is a lot of doing things in a very not-clojureish way to support Ember’s expectations.
I’d love to devise clever and fiendish ways of making Ember bend to the will of ClojureScript’s immutable datatypes and functional paradigms.
You’ll note that this goes back to the Bad Old Days of creating a top-level Application object, and manually attaching routes and components to it, and then setting up templates in script tags.
I’m hoping to come up with a basic Resolver that maps classes to ClojureScript namespaces, and I’d really love to come up with a way of updating Ember objects in an idiomatic (to Clojure) way that still triggers all the same stuff that
I’d also like to find a way to write
.hbs files and have them be compiled by the toolchain, and not write them in script tags.
While recognizing that this effort single-handedly defeats the purposes of both Ember and ClojureScript–and that it has no practical value beyond learning and fun–I fully expect to spend a goodly number of nights and weekends on it.
Here’s the .cljs file with the whole (very basic) ember app in it.
Here is the HTML file it renders to, which includes the templates: