WordPress 4.9 “Tipton”
minify patched JS files
(cherry picked from commit 5efb676b1e)
This commit is contained in:
parent
89595af55d
commit
fc62db762d
7 changed files with 106 additions and 52 deletions
16
wordpress-minify.php
Normal file
16
wordpress-minify.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
require '/usr/share/php/Patchwork/autoload-jsqueeze.php';
|
||||
|
||||
$in = file_get_contents($_SERVER['argv'][1]);
|
||||
if (!$in) exit(1);
|
||||
$jsqueeze = new \Patchwork\JSqueeze();
|
||||
$out = $jsqueeze->squeeze($in);
|
||||
if ($out) {
|
||||
printf("+ minify from %s to %s: %2d%% of %6d\n",
|
||||
basename($_SERVER['argv'][1]), basename($_SERVER['argv'][2]),
|
||||
round(strlen($out)*100/strlen($in)), strlen($in));
|
||||
file_put_contents($_SERVER['argv'][2], $out);
|
||||
} else {
|
||||
exit(2);
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue