IE8/9 - Maximum bytes for CSS file

2019-04-06 22:06发布

The application I am currently working on has excessive CSS styling and we seemed to have reached some sort of limitation with IE8/9 and how much CSS it can load. At some point it stops interpreting the CSS therefore breaking style on some pages. We are using Combres to compress/minify the files which is causing such large CSS files. This seems to happen in the 400KB-450KB range (Yes, I know that is way too much for any CSS).

So my question: What is the maximum size for a single CSS file in IE?

Also would enabling GZIP compression help? IIS has dynamic/static compression enabled and it seems to work in Chrome but not IE.

4条回答
唯我独甜
2楼-- · 2019-04-06 22:21

I came across this problem, and thought, really?? Anyway the solution is deceptively simple, use blessc from Paul Young http://blesscss.com/
Thanks Paul!

查看更多
Ridiculous、
3楼-- · 2019-04-06 22:26

For IE up to IE9 the css file size is max 288kb

查看更多
爷的心禁止访问
4楼-- · 2019-04-06 22:37

You are right with the file size being the issue (although there is also a maximum amount of selectors IE will parse). Compression won't help beyond the minification you are already doing, but splitting the CSS into two files will solve your problem.

All of the limitations are on a per-file basis. Consider separating out the CSS by feature set and only loading the CSS when needed.

查看更多
【Aperson】
5楼-- · 2019-04-06 22:37

I use Gulp-sakugawa, but you still must construct a css file to @import the other files you have just generated. https://www.npmjs.com/package/gulp-sakugawa

My problem with Bless is that it still was splitting files to 300k and that is still too large.

查看更多
登录 后发表回答