-1

With the remove of Asset Group. Is the Javascript engine necessary in production mode? I mean, I don't want to install a Javascript Engine in the production server.

I will use Turbolinks, that require coffee-rails, and I suppose it will need a Javascript Engine, is that correct?

eveevans
  • 4,392
  • 2
  • 31
  • 38

1 Answers1

0

Do you have these lines in your config/application.rb file (right after all the require lines):

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

Then you can just put your asset type stuff (coffee-rails and sass-rails etc) into the development group and it won't be required in production.

You can also take a look at this SO answer for an explanation of why assets group was specifically removed:

Why did Rails4 drop support for "assets" group in the Gemfile

Community
  • 1
  • 1
nzifnab
  • 15,876
  • 3
  • 50
  • 65
  • I understand, but in any case, when I'll run 'bundle install' in production, it will install my javascript engine, and that's exactly want I don't want. – eveevans Sep 11 '13 at 21:34
  • You have the javascript engine and related gems (`coffee-rails`) in the `:development` group in your Gemfile?. Oh wait hrmm I see your point, this line is adding them to the `assets` group which doesn't behave the right way. I see the conundrum! – nzifnab Sep 11 '13 at 21:44
  • 'coffee-rails' , no. But I'm guessing to put my Javascript Engine (therubyracer) in development group. – eveevans Sep 11 '13 at 21:45
  • If you don't want to have `therubyracer` or anything assets related at all then you can precompile your assets locally (from your dev machine) instead. However, if you precompile your asset on your production environment then, yes you need something to compile your javascript. – j03w Sep 12 '13 at 00:01
  • But, Turbolinks require 'coffee-rails' with require an Javascript engine, no? – eveevans Sep 13 '13 at 00:32