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.

Sprockets

2,215 views

Published on

Optimizing your JavaScript using fancy concatenation magic.

Published in: Technology
  • When I run the command, based on your slide, I get the following error message:

    'Only one file can be compiled to stdout at a time'

    Why would I get that message if it's able to process multiple files?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Slide #27 was a video of the SNL skit http://www.youtube.com/watch?v=QHZR9SA5pOg
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Sprockets

  1. 1. SPROCKET Optimizing Your JavaScript Using Fancy Concatenation Magic
  2. 2. SPROCKET Optimizing Your JavaScript Using Fancy Concatenation Magic this does not involve cats
  3. 3. THE PROBLEM WHAT IS SPROCKETS? USING IT
  4. 4. THE PROBLEM WHAT IS SPROCKETS? USING IT
  5. 5. Maintainability Structure vs. Performance Programmer Sanity
  6. 6. Maintainability Structured and well organized code Leads to programmer sanity But there’s an inherent problem…
  7. 7. Structure vs. Performance Bigger Applications == More Files! Longer load times == Frustrated visitors
  8. 8. THE PROBLEM WHAT IS SPROCKETS? USING IT
  9. 9. Ruby Library that helps you to...
  10. 10. Turn messy JavaScript * * otherwise known as zillions of files
  11. 11. Into clean modules for development
  12. 12. And a single* file for deployment * Yes, really. Just the one. No, for real. That’s it. Would I lie to you?
  13. 13. IT’S AWESOME!
  14. 14. THE PROBLEM WHAT IS SPROCKETS? USING IT
  15. 15. Installing It’s a Ruby Gem You don’t need to know Ruby But you do need to have Ruby and Ruby Gems installed
  16. 16. Using via Terminal
  17. 17. Using via Terminal Example Load Path
  18. 18. Dependencies //= require "sqm" //= require <sqm/admin> //= require <sqm/utilities> //= require <sqm/debugger> //= require <sqm/tooltips> //= require <sqm/lightbox> //= require <sqm/controllers> //= require <sqm/admin/utilities>
  19. 19. Dependencies //= require "sqm" //= require <sqm/admin> //= require <sqm/utilities> //= require <sqm/debugger> //= require <sqm/tooltips> //= require <sqm/lightbox> //= require <sqm/controllers> //= require <sqm/admin/utilities>
  20. 20. Dependencies //= require <sqm/admin/controllers/versions/lightbox/case_benefit> //= require <sqm/admin/controllers/versions/spreetabs> //= require "sqm" //= require <sqm/admin> //= require <sqm/utilities> //= require <sqm/debugger> //= require <sqm/tooltips> //= require <sqm/lightbox> //= require <sqm/controllers> //= require <sqm/admin/utilities>
  21. 21. Comments // a private comment /* a public comment */ /** a PDoc comment */
  22. 22. Other things it can do Insert string constants with <%= %> Bundle assets to create JS packages Can run within Ruby code Can be ran as a Rails plugin (sprocket-rails) Or as a CGI script
  23. 23. Numbers! Non-Optimized Optimized Size 344kb 204kb HTTP Requests 26 1
  24. 24. Resources I wrote it so that makes me awesome. Sam Stephenson http://getsprockets.org http://github.com/sstephenson http://github.com/sstephenson/sprockets-rails
  25. 25. Thank you! tim.novinger@gmail.com @timnovinger Screaming Monkeys Web Guild Tim Novinger 17 May 2010 Squaremouth, Inc.

×