Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Rails 3.1 Asset pipeline


Published on

Slides from my presentation at WellRailed (27th July 2011)

Additional Links:

twitter: @static_storm

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Rails 3.1 Asset pipeline

  1. 1. Rails 3.1Asset Pipeline Jeremy Olliver
  2. 2. Rails 3.1 Release Schedule• August 8th: Rails 3.1.0.rc6• August 22nd: Rails 3.1.0
  3. 3. Native Support for• Sass• Coffeescript• asset packaging/minification/compression• cache friendly static filenames (hash in filename not mtime querystring)
  4. 4. Assets Directory Structureapp assets javascripts stylesheets imagesoptional:lib/assets (non-application specific assets)vendor/assets (third party assets, css/js plugins etc)
  5. 5. How Does it Work?• manifest files specify js/css files to load• app/assets/javascripts/application.js• app/assets/stylesheets/application.css• Only needs changing for specifying load order• Picks up coffeescript, javascript, css, and sass files
  6. 6. Coffeescript / JS compilation• provided through sprockets and execjs• Need to include a javascript runtime such as node.js or a native ruby implementation such as gems ‘therubyracer’ or ‘mustang’
  7. 7. Sass / Compass / Referencing assets• use compass ‘rails31’ branch• use sass (scss) it’s awesome• referencing assets/images requires erb and asset_path helper
  8. 8. Deployment• updated capistrano version coming up• in the meantime: • rake assets:precompile RAILS_ENV=production• compiles to public/assets