GN.
GN.

Reputation: 9839

IE8 chokes on compressed CSS (Rails)

Like the title says, I'm having a problem with IE8 and compressed CSS. IE8 looks totally jacked up. (Using Rails 3.1 with asset pipeline)

At first I though it was the IE 4095 bug. It turns out I only have 1034 selectors.

In production, and also after running bundle exec rake assets precompile locally CSS began to break.

Out of curiosity, I decompressed the CSS Rails / Sprockets / Asset Pipeline spit out .. IE didn't break on the un-compressed version.

Seems as though IE8 can't handle the giant compressed file.

I put a ticket in to see if there is an option to output both a compressed and uncompressed version, then conditionally load the uncompressed to IE.

In the meantime, I'm going to try to just turn off Rails compression for the moment.

config.assets.compile = false  
// in development.rb

bundle exec rake assets precompile
// assets COMPILED anyway. agghhh!

Sort of out of ideas. Any suggestions welcome!
Thanks!

Edit

Based off this script, I started writing Middleware that serves uncompressed CSS to IE8.

I've gotten pretty far, but noticed a lack of Ruby Gems that decompress CSS.

Upvotes: 4

Views: 1165

Answers (2)

rens_m
rens_m

Reputation: 54

I had the same issue. The only work around is to break out your compressed javascript into more than one file. I ended up breaking up my scripts into two different compressed files. This fixed the issue.

Hope that helps.

Upvotes: 0

Jonathan Lin
Jonathan Lin

Reputation: 20704

I use the sass-rails gem for CSS compression.

Then in production.rb:

config.assets.compile = false
config.assets.compress = true
config.sass.style = :compressed

config.assets.compile is not doing what you expect. This actually means on-the-fly compilation, not pre-compilation. config.assets.compress is what you are looking for.

Upvotes: 1

Related Questions