I'm trying to write an SBT plugin for PlayFramework 2.1 which would precompile handlebars templates located in app/assets/templates. I will of course share this plugin when it is complete. I found this howto http://eng.netwallet.com/2012/04/25/emberhandlebars-template-precompilation-with-play/ which was a little outdated, but it was no problem adapting it for Play! 2.1.
Then I tried to compile a simple template file, but SBT failed with the following:
ember: processing template test
[error] /.../templates/test.handlebars: Compilation error[unexpected exception during Ember compilation (file=/.../templates/test.handlebars, options=List(), ember=ember-1.0.0-pre.4.js): org.mozilla.javascript.EvaluatorException: missing name after . operator (ember-1.0.0-pre.4.js#3309)]
[error] (MyProject/*:play-copy-assets) @6dap83075: Compilation error in /.../templates/test.handlebars:null
[error] (MyProject/compile:resources) @6dap83075: Compilation error in /.../templates/test.handlebars:null
ember-1.0.0-pre.4.js at line 3309 has a volatile keyword, which is apparently reserved in Rhino.
I'm far from an expert in Rhino, which is why I'm wondering if someone knows of a way to work around this? I'm not looking for a 5* solution right now. Any solution (even quick and dirty hacks like using a custom ember.js) that has a reasonable chance of working for most simple handlebars templates would work and we'd worry about polishing it once the functionality is there and the SBT plugin is out.
Thanks in advance!