documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.com/jammit/
MIT License
1.16k stars 197 forks source link

Optional browsers #22

Closed azisaka closed 14 years ago

azisaka commented 14 years ago

Every project I use Jammit + embed images is getting errors while loading images on IE8.

I think IE8 is not good enough for using embed images, so I would like to ask you if it's possible to have an option to choose what kind of DATA_URI_START the programmer wants.

jashkenas commented 14 years ago

Yikes. We will absolutely remove IE8 support for data-uris if they are not reliable. I've never seen any problems. Can you give me a link to a page where Jammit assets are breaking for IE8? Or tell me how to reproduce it (OS Version, Browser version, assets.yml setup, etc)?

documentcloud commented 14 years ago

Haven't heard back from azisaka on this issue, either here on Github or over email, so I'm closing it. If anyone encounters IE8/Jammit trouble, please reopen this with specific details about the environment and Jammit setup.

btalberg commented 14 years ago

Hi jashkenas, I actually ran into this issue. Check the header on http://drivealternatives.com/. In IE7 compatibility mode all is well. However, in IE8 our logo is missing.

jashkenas commented 14 years ago

btalberg: to help debug this, it looks like that image is right on the cusp of the 32KB IE8 limit (which Jammit respects). Do you have other (smaller size) embedded images on that page ... and if so, are they showing up or not?

btalberg commented 14 years ago

Officially the fastest response ever. Thanks jashkenas. Yes, the button images are embedded on that page too. I'll try running the drivealt image through a compressor quick and see if I can shrink it up. I'll comment here once I try it. Thanks!

jashkenas commented 14 years ago

btalberg: If that works for you, we need to do some testing to figure out how much less than 32Kb IE8 is cutting it off at. It might be 30 ... it might be 25. Then I'll adjust the limit in Jammit and push out a fresh version.

If you want to experiment or patch it yourself, the limit is the constant:

Jammit::Compressor::MAX_IMAGE_SIZE
btalberg commented 14 years ago

I overrode the constant in the rails app and realized jammit is an executable, so I tried to override it in the gem plugin, but I assume the gem needs to be rebuilt?.....

And I couldn't compress my image down far enough (I got it to 29.3kb) so I just added a kilobyte to it and let it reside outside the CSS. It is definitely a problem with file size though. Using a random 22kb image everything shows up.

jashkenas commented 14 years ago

So, as it turns out, the 32kb length is not actually 32kb. It's 32,768 characters in the Data-URI.

http://msdn.microsoft.com/en-us/library/cc848897%28VS.85%29.aspx

I've updated Jammit to measure the length in characters of the data-uri, instead of the size of the original file.

http://github.com/documentcloud/jammit/commit/855a4a39fc8a86f5437a1b6a54d169a85bd0bd6e

It'll go out with the next release. Thanks for reporting it.