承接 csssplitter/cssplitter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

csssplitter/cssplitter

最新稳定版本:1.0.0

Composer 安装命令:

composer require csssplitter/cssplitter

包简介

PHP Css Splitter for IE 4096 selector limit

关键字:

README 文档

README

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();
// 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.

Uses the MIT license.

统计信息

  • 总下载量: 927
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-09