Skip to content

andreibogdan/php-css-splitter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

PHP Css Splitter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published