Reputation: 1695
I'm running my Rails 3.1 app in production mode. I tried it out using IE 8 and some of the css files in asset's folder are not loaded properly. Everything works fine in development mode and also in other browsers even in production mode.
Please help me out with this.
I have seen this issue a lot in net. But didn't get any satisfying result.
Upvotes: 0
Views: 640
Reputation: 84182
IE has a hardcoded limit of the number of selectors a css file can contain. In ie 8 that number is 4096 - anything beyond that is ignored (see the post on the ie blog)
In development your css is split up into lots of files, but in production (by default) it all ends up in one big application.css, which could be pushing you over the limit. It's surprisingly easy with languages such as sass to unwittingly generate a lot of css.
You can split this up manually, for example if your app has a customer facing area and an admin only area perhaps you could split the css into an admin.css and an application.css part (this also has the advantage that the browser downloads/processes less irrelevant css).
You can also split up your stylesheets into portions all of which have < 4096 selectors and include all of these on all of your pages. The css_splitter gem does this automatically when you precompile your assets
Upvotes: 1