Решение для конвейера ресурсов Rails для предела селектора / таблицы стилей IE 4096

The problem

Документация Microsoft по поддержке IE объясняет, что в Internet Explorer 6-9:

All style tags after the first 31 style tags are not applied. All style rules after the first 4,095 rules are not applied. On pages that uses the @import rule to continously import external style sheets that import other style sheets, style sheets that are more than three levels deep are ignored.

Существует много доказательств этой проблемы ссценарии демонстрации, Смотрите такжеблагословить.

Solution needed

Нам нужен способ разделить скомпилированные таблицы стилей, сгенерированные Sprockets, в конвейере ресурсов, чтобы максимальное число селекторов было ниже 4096, и ссылаться на них в HTML развернутого приложения Rails.How can we pass the compiled output of processed assets (specifically stylesheets) as an argument to a method that can then modify the files?

Смотрите ниже попытки для начала. Если бы кто-то мог помочь мне найти способ сделать либо оперативное (или совершенно новое решение), это было бы фантастически!

Existing solution attempts

Bless was created to solve this problem by splitting up stylesheets to keep the max selector count per sheet under the limit. Bless runs on the server in node.js. I haven't seen a Ruby-equivalent yet. Eric Fields tried to serve assets compiled with compass to Bless (running in node), but that solution depends on Compass handling asset compilation, and thus doesn't seem to work with the asset pipeline. Note that instead of linking to multiple stylesheets, Bless adds @include statements to the first sheet, which may be the way to go so as to avoid touching the markup.

When Christian Peters (@crispy) discovered this problem, he implemented a splitter like Bless that also passed Compass output to a custom module, which worked great before Rails 3.1. Later he adapted his splitter with a SprocketsEngine for integration with the Rails Asset pipeline. I've tried implementing the new code, but it doesn't seem to function automatically (though the splitter works fine when called manually in the console).

Related information

Для получения дополнительной информации об ограничениях CSS в IE 6-9, посмотрите эти связанные вопросы:

Does IE 8 have a limit on number of stylesheets per page? Internet Explorer's CSS rules limits

Ответы на вопрос(2)

Ваш ответ на вопрос