1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[asset pipeline] Add production assets section

This commit is contained in:
Ryan Bigg 2011-06-28 08:25:14 +10:00
parent 9959fa2d15
commit 6a1803a14f

View file

@ -95,7 +95,18 @@ In addition to this single layer of pre-processing, we can also put on additiona
Keep in mind that the order of these pre-processors is important. For example, if we called our JavaScript file +app/assets/javascripts/projects.js.erb.coffee+ then it would be processed with the CoffeeScript interpreter first, which wouldn't understand ERB and therefore we would run into problems. Keep in mind that the order of these pre-processors is important. For example, if we called our JavaScript file +app/assets/javascripts/projects.js.erb.coffee+ then it would be processed with the CoffeeScript interpreter first, which wouldn't understand ERB and therefore we would run into problems.
h3. Compressing Assets h3. Production Assets
In the production environment, assets are served slightly differently to how they are served in the development environment.
TODO: Talk here about:
* Rack::Cache's caching
* Sprocket's auto-generated MD5 hashes
* Sass-rails's handy +image_url+ helpers
* ERB pre-processing and +asset_url+
h4. Compressing Assets
The default Gemfile also includes the "uglifier":https://github.com/lautis/uglifier gem. This gem wraps "UglifierJS":https://github.com/mishoo/UglifyJS (written for NodeJS) in Ruby. It compress your code by removing white spaces and other magical things like changing your if and else statements to ternary operators when possible. The default Gemfile also includes the "uglifier":https://github.com/lautis/uglifier gem. This gem wraps "UglifierJS":https://github.com/mishoo/UglifyJS (written for NodeJS) in Ruby. It compress your code by removing white spaces and other magical things like changing your if and else statements to ternary operators when possible.