定制 phrozenbyte/cssmin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

phrozenbyte/cssmin

最新稳定版本:v3.0.4

Composer 安装命令:

composer require phrozenbyte/cssmin

包简介

CssMin is a css parser and minfier. It minifies css by removing unneeded whitespace character, comments, empty blocks and empty declarations. In addition declaration values can get rewritten to shorter notation if available. The minification if configurable.

关键字:

README 文档

README

A (simple) css minifier with benefits

This repository is a copy of CssMin by Joe Scylla, previously hosted on Google Code, to support Composer. Please refer to the original homepage of CssMin on Google Code for more info: http://code.google.com/p/cssmin/

This GitHub fork aims to be the go-to address for Joe Scylla's CssMin. It was converted into a Composer library utilizing Composer's autoloader with the original non-concatenated PHP sources and aims to also include fixes from other CssMin forks. Even though this project isn't actively developed, we accept pull requests fixing existing problems, like compatibility issues with later PHP versions. Visit us on GitHub for more info: https://github.com/PhrozenByte/cssmin

What is CssMin?

CssMin is a CSS parser and minfier. It minifies CSS by removing unneeded whitespace characters, comments, empty blocks and empty declarations. In addition declaration values can get rewritten to shorter notations if available. The minification is configurable.

CssMin has some benefits. It supports the rewrite of CSS Level 3 properties to their browser specific counterparts and is able to simulate CSS variables.

Install

CssMin is available on Packagist.org and may be included in other projects via composer require phrozenbyte/cssmin. CssMin requires PHP 5.0+

Syntax

string CssMin::minify(string $source [, array $filters = array()][, array $plugins = array()]);
  • string $source - The source css as string.
  • array $filters - The filter configuration as array (optional).
  • array $plugins - The plugin configuration as array (optional).

Example

// Simple minification WITHOUT filter or plugin configuration
$result = CssMin::minify(file_get_contents("path/to/source.css"));

// Minification WITH filter or plugin configuration
$filters = array(/* ... */);
$plugins = array(/* ... */);

// Minify via CssMin adapter function
$result = CssMin::minify(file_get_contents("path/to/source.css"), $filters, $plugins);

// Minify via CssMinifier class
$minifier = new CssMinifier(file_get_contents("path/to/source.css"), $filters, $plugins);
$result = $minifier->getMinified();

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-04-11