定制 wikimedia/minify 二次开发

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

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

wikimedia/minify

最新稳定版本:2.9.0

Composer 安装命令:

composer require wikimedia/minify

包简介

Minification of JavaScript code and CSS stylesheets.

README 文档

README

Minify is a PHP library for minification of JavaScript code and CSS stylesheets.

Quick start

Install using Composer, from Packagist.org:

composer require wikimedia/minify

Usage

use Wikimedia\Minify\JavaScriptMinifier;

$input = '
/**
 * @param a
 * @param b
 */
function sum(a, b) {
	// Add it up!
	return a + b;
}
';

$output = JavaScriptMinifier::minify( $input );
// Result:
// function sum(a,b){return a+b;}
use Wikimedia\Minify\CSSMin;

$input = '
.foo,
.bar {
	/* comment */
	prop: value;
}
';

$output = CSSMin::minify( $input );
// Result:
// .foo,.bar{prop:value}

Known limitations

The following trade-offs were made for improved runtime performance and code simplicity. If they cause problems in real-world applications without trivial workarounds, please let us know!

  • T37492: In CSS, content within quoted strings that looks like source code are sometimes minified.

  • T287631: In CSS, writing a URL over multiple lines with escaped line-breaks is not supported.

Contribute

See also

统计信息

  • 总下载量: 762.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 1
  • 依赖项目数: 10
  • 推荐数: 1

GitHub 信息

  • Stars: 6
  • Watchers: 17
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2021-02-09