In the config/application.rb
file in a Rails app, there's the following section of code:
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
I'm perhaps not clear what Bundler.require
is doing. I was under the impression that it required the specified sections in the Gemfile, but I'm not clear as to why Bundler.require *Rails.groups(...)
causes it to precompile and Bundler.require(...)
causes assets to be lazily loaded.