2017 © Pedro Peláez
 

library css-splitter

PHP Css Splitter for IE 4096 selector limit

image

dlundgren/css-splitter

PHP Css Splitter for IE 4096 selector limit

  • Thursday, December 24, 2015
  • by dlundgren
  • Repository
  • 2 Watchers
  • 8 Stars
  • 29,925 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 2 Versions
  • 11 % Grown

The README.md

PHP Css Splitter

Build Status, (*1)

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

Installation

Use composer, (*3)

Usage

The default max selectors is 4095., (*4)


$splitter = new \CssSplitter\Splitter(); // Load your css file $css = file_get_contents('styles.css'); // Skip the first part as the Internet Explorer interprets your css until it reaches the limit $selector_count = $splitter->countSelectors($css) - 4095; // Calculate how many additional parts we need to create $additional_part_count = ceil($selector_count / 4095); if($additional_part_count > 0) { // Loop and create the additional parts // Add an offset of two as we are creating the css from the second part on for($part = 2; $part < $additional_part_count + 2; $part++) { // Create or update the css files file_put_contents('styles_'. $part .'.css', $splitter->split($css, $part)); } }

Credits & License

Original inspiration came from the Ruby gem CssSplitter., (*5)

Uses the MIT license., (*6)

The Versions

24/12 2015

dev-master

9999999-dev

PHP Css Splitter for IE 4096 selector limit

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

css splitter

08/10 2015

1.0.0

1.0.0.0

PHP Css Splitter for IE 4096 selector limit

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

css splitter