1 Star 7 Fork 2

clevstn/Yii Manager 2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
pack 1.90 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env php
<?php
/**
* Introduce:
*
* The `compiler.jar` download for https://github.com/google/closure-compiler, The Plugins used of Js compress and merge.
* Command params:
* --js [[Specifies the JS file to be compressed]]
* --js_output_file [[The compressed JS file name and position]]
* --create_source_map [[File name and location of the compressed SourceMap]]
* --source_map_format [[SourceMap version]]
*
* The `yuicompressor.jar` download for https://github.com/yui/yuicompressor, The Plugins used of Css compress and merge.
*
* Dependent Java environment, The java installation address:
* https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
*
* Console execute:
* js:
* pack --js --from=./builder/assets/spinner2/spinner.dot.js --to=./builder/assets/spinner2/spinner.dot.min.js --map=./builder/assets/spinner2/spinner.dot.min.js.map
*
* css:
* pack --css --from=./builder/assets/spinner2/spinner.dot.css --to=./builder/assets/spinner2/spinner.dot.min.css
* pack --css --from=./builder/assets/toastr2/toastr.css --to=./builder/assets/toastr2/toastr.min.css
*/
$command = [
'js' => 'java -jar compiler.jar --js [--from] --js_output_file [--to] --create_source_map [--map]',
'css' => 'java -jar yuicompressor.jar --type css [--from] -o [--to]',
];
$params = [];
foreach ($_SERVER['argv'] as $exp) {
parse_str($exp, $arr);
$params = array_merge($params, $arr);
}
if (key_exists('--css', $params)) {
$executeCommand = $command['css'];
} elseif (key_exists('--js', $params)) {
$executeCommand = $command['js'];
} else {
$executeCommand = '';
}
$replaceParams = [];
if (!empty($executeCommand)) {
foreach ($params as $key => $val) {
$replaceParams["[{$key}]"] = $val;
}
$executeCommand = strtr($executeCommand, $replaceParams);
$result = exec($executeCommand);
echo $result;
exit(0);
}
echo 'Please select command.';
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/clever_stone/ym2.git
[email protected]:clever_stone/ym2.git
clever_stone
ym2
Yii Manager 2
master

搜索帮助