I prefer Sprockets (rails asset pipeline, <a href="https://github.com/sstephenson/sprockets" rel="nofollow">https://github.com/sstephenson/sprockets</a>), which is Rack based..
Or you can do this on the Rack level: <a href="https://github.com/juliocesar/rack-pagespeed" rel="nofollow">https://github.com/juliocesar/rack-pagespeed</a>