wikimedia/minify
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!
- In CSS, content within quoted strings that looks like source code is sometimes minified (T37492).
- In CSS, writing a URL over multiple lines with escaped line-breaks is not supported (T287631).
- In JS, certain multibyte spaces are not supported as whitespace in source code (including U+00A0 No Break Space NBSP, U+2028 Line Separator, and U+2029 Paragraph Separator) and may produce invalid output. Note that these and other Unicode multibyte characters are fully supported in strings, identifiers, and regexes (change 1278715).
Contribute
- Issue tracker: https://phabricator.wikimedia.org/tag/wikimedia-minify/
- Source code: https://gerrit.wikimedia.org/g/mediawiki/libs/Minify
- Submit patches via Gerrit: https://www.mediawiki.org/wiki/Developer_account
- To run tests:
composer update, thencomposer test
See also
- High-level documentation: https://www.mediawiki.org/wiki/ResourceLoader/Architecture
wikimedia/minify 适用场景与选型建议
wikimedia/minify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 927.87k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2021 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wikimedia/minify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wikimedia/minify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 927.87k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 24
- 依赖项目数: 15
- 推荐数: 1
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2021-02-09