Rails Asset Pipeline     Nathan Broadbent        Onboard Coding Ltd.https://twitter.com/ndbroadbenthttp://github.com/ndbro...
Sprockets●   Packages and minifies your JavaScript and    CSS assets●   Dependency management●   Pre-processor pipeline   ...
Sprockets Directives●   //= require example_asset    –   searches app/assets/, vendor/assets, lib/assets,        <gem>/app...
Gems to improvethe asset pipeline
turbo-sprockets-rails3●   Speeds up rake assets:precompile by only    recompiling changed assets, based on a hash    of th...
turbo-sprockets-rails3    Benchmark on a small Rails app:●   Uninstalled: 26.993s●   Installed    –   first run: 18.525s  ...
quiet_assets●   Hide asset requests in your Rails logs.●   Lets you focus on SQL queries and rendering●   Just add gem qui...
assets_precompile_enforcer●   Raises an exception if an asset is not found in    config.assets.precompile●   Avoid 500 err...
Assets in Rails 4●   Much faster, dont need turbo-sprockets-rails3●   Non-digest assets are no longer compiled if    finge...
Questions orComments?
Upcoming SlideShare
Loading in …5
×

Rails 3 Asset Pipeline

1,154 views

Published on

Slides from my Rails 3 Asset Pipeline presentation

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,154
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Rails 3 Asset Pipeline

  1. 1. Rails Asset Pipeline Nathan Broadbent Onboard Coding Ltd.https://twitter.com/ndbroadbenthttp://github.com/ndbroadbent
  2. 2. Sprockets● Packages and minifies your JavaScript and CSS assets● Dependency management● Pre-processor pipeline – CoffeeScript – SCSS / LESS – Minification
  3. 3. Sprockets Directives● //= require example_asset – searches app/assets/, vendor/assets, lib/assets, <gem>/app/assets – will find: ● example_asset.js ● example_asset.js.coffee ● example_asset.js.coffee.erb● //= require_tree . – recursively requires all assets in the current directory, including subdirectories
  4. 4. Gems to improvethe asset pipeline
  5. 5. turbo-sprockets-rails3● Speeds up rake assets:precompile by only recompiling changed assets, based on a hash of their source files● Only compiles once to generate both fingerprinted and non-fingerprinted assets
  6. 6. turbo-sprockets-rails3 Benchmark on a small Rails app:● Uninstalled: 26.993s● Installed – first run: 18.525s – unchanged assets: 9.386s
  7. 7. quiet_assets● Hide asset requests in your Rails logs.● Lets you focus on SQL queries and rendering● Just add gem quiet_assets to Gemfile
  8. 8. assets_precompile_enforcer● Raises an exception if an asset is not found in config.assets.precompile● Avoid 500 errors in production due to uncompiled assets
  9. 9. Assets in Rails 4● Much faster, dont need turbo-sprockets-rails3● Non-digest assets are no longer compiled if fingerprints enabled● Source maps support: Easily debug errors in minified javascript – http://www.html5rocks.com/en/tutorials/developert ools/sourcemaps/ – If you give your asset source maps to Errbit, it could show you where a production error occurred in the original (unminified) JavaScript
  10. 10. Questions orComments?

×