Playframework 2.1 precompiling ember handlebars

I am trying to write an SBT plugin for PlayFramework 2.1 that would precompile the descriptor templates located in app / assets / templates. Of course, I will share this plugin when it is complete. I found this method http://eng.netwallet.com/2012/04/25/emberhandlebars-template-precompilation-with-play/ , which was a bit outdated, but that is not a problem by adapting it for Play! 2.1.

Then I tried to compile a simple template file, but SBT was unable to complete the following steps:

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 on line 3309 has the volatile keyword, which seems to be reserved in Rhino.

I am far from an expert in Rhino, so I wonder if anyone knows how to get around this? I'm not looking for a 5 * solution right now. Any solution (even quick and dirty hacks, such as using custom ember.js) that has reasonable chances to work with most simple pen templates will work, and we will worry about polishing it after the functionality is there, and the SBT plugin missing.

Thanks in advance!

+5
source share
3 answers

I wrote an equivalent plugin for Grails. I get the same error if I switch from rhino 1.7R4 to 1.7R2. You need to switch to org.mozilla: rhino: 1.7R4.

, . : https://github.com/florent-blanvillain/grails-ember-templates-precompiler/blob/master/src/groovy/org/grails/plugin/ember/handlebars/Precompiler.groovy

0

ember, volatile, , JavaScript EC3. EC5

. https://github.com/emberjs/ember.js/issues/1202

ember-1.0.rc1, . ember.js ,

0

My ember precompilation plugin in game 2.1 works. It supports ember-1.0.0-pre.2, ember-1.0.0-rc.1 and ember-1.0.0-rc.3 and works around problems related to rhino.

See https://github.com/krumpi/play-emberjs

0
source

All Articles