Sass: Dealing with the IE 4095 selectors per stylesheet restriction

前端 未结 3 1557
执念已碎
执念已碎 2021-02-04 17:29

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 bi

3条回答
  •  -上瘾入骨i
    2021-02-04 17:54

    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

提交回复
热议问题