title: Sass: Dealing with the IE 4095 selectors per stylesheet restriction
body: <p><em>Note: This question refers to a Rails project with Sass &amp; Compass.
  Using the Rails Asset Pipeline? Then have a look at <a href="https://stackoverflow.com/questions/12126118/rails-asset-pipeline-solution-for-ie-4096-selector-stylesheet-limit/">this question</a>.</em></p>
  
  <p>We are developing a big application with many use cases and many individually styled pages, partly for multiple contexts. Which simply means a lot of style information. </p>
  
  <p>With the newest section of our application, we have broken Internet Explorer's limit of 4095 selectors per stylesheet. (Want a proof of this limitation? <a href="http://marc.baffl.co.uk/browser_bugs/css-selector-limit/" rel="nofollow noreferrer">http://marc.baffl.co.uk/browser_bugs/css-selector-limit/</a>)</p>
  
  <p>Okay. So, why do we not simply split the application style sheet into multiple ones by design?</p>
  
  <p>Well, mixins and selector inheritance will not work across multiple Sass files (not partials), right?</p>
  
  <p>I'd say the quality of the stylesheets is rather good, we cannot optimize away the exceeding amount of selectors. (There is rather more to come.)
  I also believe that minimizing the amount of selectors should not be our primary optimization goal. The Sass core team advises to use selector inheritance instead of mixins where applicable in order to save CSS file size. By doing so, the number of selectors tends to grow though.</p>
  
  <p>So what should I do?</p>
  
  <p>I am thinking about writing a script that generates additional css files, partitioning my big application.css file. These would only be loaded in IE then (so that I don't have multiple requests in modern browsers).
  I would need a simple css parser for that in order to cut the application.css file after max. 4095 selectors at a valid position. 
  And I would need an compass compile - after hook so that developers don't need to generate the IE files by hand in order to test it.</p>
  
  <p>Please, tell me, that you got a better idea!</p>
  
  <p>Best,
  Christian</p>