代码拉取完成,页面将自动刷新
#!/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.';
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。