Your SlideShare is downloading. ×
Rails 3 Asset Pipeline
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Rails 3 Asset Pipeline

831
views

Published on

Slides from my Rails 3 Asset Pipeline presentation

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
831
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Rails Asset Pipeline Nathan Broadbent Onboard Coding Ltd.https://twitter.com/ndbroadbenthttp://github.com/ndbroadbent
  • 2. Sprockets● Packages and minifies your JavaScript and CSS assets● Dependency management● Pre-processor pipeline – CoffeeScript – SCSS / LESS – Minification
  • 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. Gems to improvethe asset pipeline
  • 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. turbo-sprockets-rails3 Benchmark on a small Rails app:● Uninstalled: 26.993s● Installed – first run: 18.525s – unchanged assets: 9.386s
  • 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. 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. 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. Questions orComments?