I’m using ember-rails. I’d like to use it only during the compile phase, putting it (and ember-source) in the :assets group in Gemfile. I’d also like to include the handlebars runtime as a gem in the :assets group. Is this possible? Does ember-rails need to be around at runtime?
Yes, this is possible. Putting ember-rails in the assets group works very well for me.
Interesting, we threw it into the assets group and got the following error:
Error during sync:
rake aborted!
undefined method `ember' for #
/tmp/brigade-temp-web-145051299/Rakefile:4:in `require'
(See full trace by running task with --trace)
Command bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile returned status code 256
make: *** [assets_precompile] Error 1
make: *** Waiting for unfinished jobs....
We’ve not dug in yet, but it would appear that putting it into the :assets
group in Gemfile causes some method to not be visible during assets_precompile. Are we missing something obvious? We’ll let you know what we find as we investigate.
We got this to work. We needed to make sure we weren’t configuring ember (e.g. config.ember.variant) in environment configurations unless Rails.groups includes :assets. Then, when running a development server, add :assets to Rails.groups for local development.
Thanks for letting us know it was possible, oneiros! Hope this is helpful to someone else.
As a side note, I’ve seen a lot of examples of Gemfiles where people include ember-rails outside of :assets. If you do things this way, since ember-rails relies on ExecJS, your server won’t start unless you have node (or some other JavaScript runtime) on the box.