alexccavaco/jomi
Composer 安装命令:
composer require alexccavaco/jomi
包简介
Minifier for PHP
README 文档
README
Minifier for PHP
JoMi Joins and Minifies one or multiple files into one. It can use .json files (called modules) to configure file manipulations or do so via the class itself. Manipulations happen when any of the source files are changed, otherwise, no processing occurs.
Installation
composer require alexccavaco/jomi
Running JoMi moduled in Class
$mod = JoMi::runUsing($name, $config, $vars);
$mod->add($arrayOfFiles, $pathToDestination, $type);
$mod->run();
JoMi::runUsing() takes three arguments. The first represents the name of the module and is required, the second is a configuration array and the third an array o variables (to be used to ease file paths). The last two are optional.
Configurations:
- "module-location" - Represents the folder where modules are stored
- "file-base-path" - Represents the base folder of the files
Note: The module-location is also the place JoMi uses to store and remember previous update times.
The add method creates a minified instance of $arrayOfFiles pointing to $pathToDestination. The latter containing both the joined and the minified data (after running). The third and last argument establishes the type of files being handled, currently css or js files only. This argument is optional, and if it's not set, JoMi will look into the $pathToDestination file type (.css or .js) to make the decision.
The add method can be chained as exemplified below:
JoMi::runUsing($name, $config, $vars)->add(...)->add(...)->run();
Running JoMi using Module Files
JoMi::runModule($name, $config, $vars);
JoMi::runModule() takes three arguments. The first represents the name of the module and is required, the second is a configuration array and the third an array o variables (to be used to ease file paths). The last two are optional.
Configurations are as above.
Module Json Example File:
{varname} - Represents a variable named "varname". These can be assigned via "var" keys as shown in the example below.
{
"var": {
"public": "{root}/public",
"var": "{root}/var"
},
"join": [
{
"files":[
"{var}/test1.css",
"{var}/test2.css"
],
"into": "{public}/test.min.css",
"type": "css",
"updated": 1558896289
},
{
"var":{
"public": "{root}/public/"
},
"files":[
"{var}/test1.js",
"{var}/test2.js",
"{var}/test3.js"
],
"into": "{public}/test.min.js",
"type": "js",
"updated": 1558896289
}
]
}
alexccavaco/jomi 适用场景与选型建议
alexccavaco/jomi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 05 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 alexccavaco/jomi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alexccavaco/jomi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 38
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-26