Reputation: 69
I tried to find the importance of assets pipeline in net but could not get any clarity on it. Why are few gems placed in group :assets and mentioned not required in production in comments part ? I have three small questions to get clarified.
What do we exactly mean by assets PIPELINE ? Why do we need assets group ? Why don't we need these gems in production ?
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
Upvotes: 2
Views: 106
Reputation: 2951
Essential reading here: http://guides.rubyonrails.org/asset_pipeline.html
What is the Asset Pipeline?
The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages such as CoffeeScript, Sass and ERB.
The reason for separating these particular gems into their own group, is that they are not needed in production, when rake assets:precompile
is run, it creates all of the assets in a form that web browsers can understand (these are stored in the public directory once you've deployed)
e.g. CoffeeScript is compiled into javascript, sass is compiled into CSS. Uglifier just minifies the javascript.
Upvotes: 2