Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6233351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:17:01+00:00 2026-05-24T10:17:01+00:00

Note: This question refers to a Rails project with Sass & Compass. Using the

  • 0

Note: This question refers to a Rails project with Sass & Compass.
Using the Rails Asset Pipeline? Then have a look at this question.

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.

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? http://marc.baffl.co.uk/browser_bugs/css-selector-limit/)

Okay. So, why do we not simply split the application style sheet into multiple ones by design?

Well, mixins and selector inheritance will not work across multiple Sass files (not partials), right?

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.

So what should I do?

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.

Please, tell me, that you got a better idea!

Best,
Christian

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:17:01+00:00Added an answer on May 24, 2026 at 10:17 am

    Mixins are usable across multiple files. However, it is logically not possible that @extend may work with multiple files. It is the purpose of this directive to result in a single rule
    (which should not be duplicated across multiple files). Therefore, I cannot split up files.

    Thus, I implemented a splitter: https://gist.github.com/1131536

    After these two commits have found their way into Sass and Compass, you can use the following hook in your Rails config/compass.rb in order to automatically create the additional stylesheets for IE:

    on_stylesheet_saved do |filename|
      if File.exists?(filename)
        CssSplitter.split(filename)
      end
    end
    

    Update:

    The CssSplitter mentionend above has been release as a gem: https://github.com/zweilove/css_splitter

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: In this question I'm using the term autocomplete (or iterative search) to refer
(NOTE: This question is not about escaping queries, it's about escaping results) I'm using
Note: This question has broadened in scope from previous revisions. I have tried to
Note: This question refers to a very old version of jQuery.validate() (version 1.5). This
Note 1: This question refers to HTML5 videos only, not Flash videos. Note 2:
Note that this question refers to the version running the app, not all versions
Note this question was originally posted in 2009, before C++11 was ratified and before
Moderator note: This question is not a good fit for our question and answer
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost
(note that this question is not about CAS, it's about the May fail spuriously

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.