as a heavy jquery w/ plugins user, it is easy to end up with quite a few javascript files included in the header. in an attempt to cut down on the load time, i’ve been giving sprockets a whirl. sprockets is a javascript organization and compressor library written in ruby.
what turned me onto trying sprockets was the success i have had with less, the dynamic css library, which allows me easy management over grid, font, color, and classes stylesheets that get compiled down to one css file.
the one thing i was bummed to not see in the sprockets documentation was the ability to run a rake script that would watch for file changes and keep the master js file constantly updated, like you can with less.
luckily ‘the google’ revealed a simple rake file gist (which i’ve forked) for just that. given a directory structure of js/src (for your source files) and js/o/scripts.js as your master work file, save this file as a rakefile.rb in js/ and just run in the command line =>
rake watch
now, changes to your work file will be detected and updated js/scripts.js and js/scripts-min.js will be compiled.