zweilove / css_splitter

Gem for splitting up stylesheets that go beyond the IE limit of 4095 selectors, for Rails 3.1+ apps using the Asset Pipeline.
MIT License
160 stars 47 forks source link

Properly handle media query closing braces #30

Closed Umofomia closed 10 years ago

Umofomia commented 10 years ago

I noticed media query blocks weren't properly being handled when they occur entirely before the split. For instance, for the following CSS:

@media print {
  .media-rule { color: black; }
}
.a0 { color: black; }
.a1 { color: black; }
/* ... */
.a4093 { color: black; }
.first-after-split { color: black; }

We would expect that the split would just contain this:

.first-after-split { color: black; }

However, without this fix, it ends up containing this:

@media print {
  .a4093 { color: black; }
  .first-after-split { color: black; }
}

This was caused by two issues:

jhilden commented 10 years ago

Thanks a lot.

@matthewd and @esbeka contributed the original implementation of this in #26 maybe they can review your changes to verify that everything is cool? After that I would cut a new release.