as a heavy jquery w/ plugins user, it is easy to end up with quite a few javascript files included in the header. thats where sprockets, a javascript organization and compressor library written in ruby, comes in.
what turned me onto trying sprockets was the success i’ve had with less, the dynamic css library. the one thing i was bummed to not see in the sprockets documentation, however, was the ability to run a 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 and modified) 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 rakefile.rb in js/ and just run =>
rake watch
now, changes to your work file will be detected and updated js/scripts.js and js/scripts-min.js will be compiled.
update: if you use rails, the sprockets plugin is much better.