sstephenson/sprockets — Issue #269: can't declare processors on binary assets on ruby 1.9
Author: botandrose
Created: 2011-12-26 23:34:23+00:00
State: open

Howdy,

I've written a little preprocessor for losslessly compressing pngs and jpgs: https://github.com/botandrose/sprockets-image_compressor . Works great on Ruby 1.8.

However, it appears when running on Ruby 1.9, sprockets will open any source png or jpg as UTF-8, rather than binary, because there are processors associated with it, and then immediately barf because the source image isn't valid UTF-8. See:

https://github.com/sstephenson/sprockets/blob/477c40915e00e752c473011ffb67842a550ae782/lib/sprockets/base.rb#L246

I think being able to do processing on binary assets is a valid use-case, and I don't see a way to change this behavior without monkeypatching sprockets, so I'm opening this issue. Thoughts?