Skip to content

Latest commit

 

History

History
executable file
·
33 lines (21 loc) · 922 Bytes

File metadata and controls

executable file
·
33 lines (21 loc) · 922 Bytes

PHP Css Splitter

Build Status

Splits stylesheets that go beyond the IE limit of 4096 selectors. See this MSDN blog post for more information about this.

Installation

Use composer

Usage

The default max selectors is 4095.

$splitter = new \CssSplitter\Splitter();
$count = $splitter->countSelectors($css)  - 4095;
if ($count > 0) {
    $part = 2;
    for($i = $count; $i > 0; $i -= 4095) {
        file_put_contents("styles-split{$part}.css", $splitter->split($css, 2));
    }
}

Credits & License

Original inspiration came from the Ruby gem CssSplitter.

Uses the MIT license.