views:

76

answers:

5

I just worked out, by trial-and-error, that IE 7 has an upper limit of 32 stylesheet includes (i.e. tags).

I'm working on the front-end of a very large website, in which we wish to break our CSS into as many separate files as we wish, since this makes developing and debugging much easier.

Performance isn't a concern, as we do compress all these files into a single package prior to deployment.

The problem is on the development side. How can we work with more than 32 stylesheets if IE 7 has an upper limit of 32?

Is there any means of hacking around this?

I'm trying to come up with solutions, but it seems that even if I loaded the stylesheets via Ajax, I'd still be writing out tags, which would still count towards the 32-stylesheet limit.

Is this the case? Am I stuck with the 32-file limit or is there a way around it?

NOTE: I'm asking for a client-side solution to this. Obviousy a server-side solution isn't necessary as we already have a compression system in place. I just don't want to have to do a re-compress every time I make one little CSS change that I want to test.

+1  A: 

Have you tried @import?

ae
By jove, it works!
jonathanconway
Same issue with @import :(
jonathanconway
A: 

At my last company we solved this by mashing all the CSS into one big document and inserting a URL in the web page that referenced that one-shot document. This was all done on-the-fly, just before returning the page to the client (we had a bunch of stuff going on behind the scenes that generated dynamic CSS).

You might be able to get your web server to do something similar, depending on your setup, otherwise it sounds like you're stuck with only 32 files.

Or you could just not support IE7 ;)

Cameron Skinner
+5  A: 

I'm going to add this as a separate answer just to see how many up and down votes it gets:

Don't support IE7.

EDIT: To avoid confusion: I'm not seriously suggesting this as a real solution. No flames, please!

Cameron Skinner
Tee hee hee. First up-vote :)
Cameron Skinner
+1, or don't use more than 32 stylesheets.
Fosco
A: 

Not really an answer, but I remember while using Drupal 6 (CMS), there was an option to aggregate stylesheets when a page is requested. Perhaps you could programmatically do something similar.

zourtney
+1  A: 

Create CSS files on the server side and merge all files that are needed for this certain page.

If you are using Apache or Lighttp consider using mod_concat

Hippo
I already have a serverside compression solution and don't need another one. I need a *client-side* solution.
jonathanconway
its no compression, is merging files together...
Hippo