Sprockets: A Ruby-powered JavaScript dependency library from 37signals
Managing and organizing multiple JavaScript files in your Rails applications can be a real pain, especially when it comes to deploying your application and you need to minimize those JavaScript files down for better application performance.
Enter Sprockets, the new dependency management and concatenation library from 37signals (or, more specifically, Sam Stephenson). Once installed, Sprockets allows you to organize your application’s JavaScript files into smaller more manageable chunks that can be distributed over a number of directories and files.
Using directives at the start of each JavaScript file, Sprockets can determines which files your current JavaScript file depends on. When it comes to deploying your application, Sprockets then uses these directives to turn your multiple JavaScript files into a single file for better performance.
Sprockets also allows you bundle assets with your JavaScript, as well as allowing you to insert string constants in your JavaScript files, using a YAML file.
Sprockets is available as a Ruby gem or as a Rails plugin. The Sprockets source code is also available on GitHub.
Post by Matthew Lang - Matthew Lang is an ERP developer with a keen interest in Ruby and Rails programming.
February 20, 2009 at 1:45 am
It would have been useful some insight about the experience of using the library instead of rewriting the 37s blog entry
February 20, 2009 at 5:17 am
this is super great, way to go sam yet again
February 20, 2009 at 9:33 pm
@Paul: Sprockets just came out. How much experience do you expect the Matthew Lang to have acquired at this stage?
February 25, 2009 at 12:16 am
sprockets looks interesting, sounds alot like a project started last year, execpt the rails part but ruby love aswell: github.com/lian/javascript-bundle ..allways liked the idea of a bundle with most common javascript libraries keept updated and documented. only needs some contributers! ;)