While a hack, a dirty way of getting Juicer to merge JavaScript files at every load is the following, which I’m running under a custom Webrick setup:
# Shamelessly cheat so Juicer cannot close its copy of STDOUT module Juicer LOGGER.instance_eval do def close ; end end end # Later, far away in a custom handler Juicer::Cli.run(%w[merge -s --force -o /tmp/output.js js/my.js]) # Unfortunately, may be a large file to read all at once minified = File.open('/tmp/output.js', 'r') {|f| f.read} # ... do something with minified
It doesn’t look like it should be too difficult to modify Juicer to do the above more naturally and have it return a filehandle to the concatenated temporary file. Another time, perhaps.