sstephenson/sprockets — pull request #273 by botandrose (2011-12-29 01:12:17+00:00)
Title: force binary encoding for assets with mime types that begin with "image/", "audio/", or "video/".

Another solution to issue #269. In pull request #272, @josh suggested forcing binary encoding for any asset that has a mime type that doesn't begin with "text/". This sounded like a good solution, but it turns out that javascript has a mime type of "application/javascript". So, instead I've created a whitelist of mime type matchers that should have binary encoding enforced. This won't cover every exotic binary asset, but it shouldn't break any existing use cases, and should allow sprockets to use processors on the binary assets we use 99% of the time.

Also, if this approach is the right one, I can imagine later exposing the BINARY_MIME_TYPES matcher array via the api so that one could enforce binary encoding for any exotic mime type they might want to process.

Lastly, I wasn't sure the best way to test this addition, so I just added some tests to the test/encodings_test.rb. There is probably a better way to test it.

What do you guys think? Is this merge-worthy?