0

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.

4
  • Try this blog : Rails Asset Pipeline Handing of CSS and JS This blog can give you idea to handle css and js with production environment. Commented Apr 24, 2014 at 12:10
  • Please provide the exact version number of Rails and the folder structure of your supposed asset. Then add the URL you are trying to get and the error message of the browser, then maybe somebody will be able to help you. Commented Apr 24, 2014 at 12:10
  • there is no error.. Simply the css file wont load in IE8 when i run in it in production mode. Commented Apr 24, 2014 at 12:14
  • Then do as I said, post the request you try to fetch and the folder structure of your assets, maybe somebody will be able to help. Commented Apr 24, 2014 at 12:17

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.