public static function minify($code, $options = array()) { // @todo: set encoding options based on $options :) $packer = new JavascriptPacker($code, 'Normal', true, false); return trim($packer->pack()); }
/** * 压缩js文件 * * @author mrmsl <*****@*****.**> * @date 2012-07-10 15:59:37 * @lastmodify 2013-01-22 10:52:51 by mrmsl * * @param string $filename 文件名 * * @return void 无返回值 */ private function _packFile($filename) { $packer = new JavascriptPacker(file_get_contents($filename)); $packed = $packer->pack(); file_put_contents(PACKER_JS_PATH . 'pack/' . basename($filename, '.js') . '.pack.js', $packed); unset($packer, $packed); }
/** * 压缩js文件 * * @author mrmsl <*****@*****.**> * @date 2012-07-10 15:59:37 * @lastmodify 2013-01-22 10:52:51 by mrmsl * * @param string $filename 文件名 * * @return void 无返回值 */ private function _packFile($filename) { $packer = new JavascriptPacker(file_get_contents($filename)); $packed = $packer->pack(); file_put_contents(substr_replace($filename, '.min.js', -3), $packed); unset($packer, $packed); }
public static function minify($code, $options = array()) { // todo: set encoding options based on $options :) @author Pulipuli Chen <*****@*****.**> 20151102 $packer = new JavascriptPacker($code, 'Normal', true, false); return trim($packer->pack()); }