php-yui-compressor
所属分类:压缩解压
开发工具:PHP
文件大小:0KB
下载次数:0
上传日期:2014-06-03 12:02:21
上 传 者:
sh-1993
说明: YUI压缩器的现代PHP包装器,
(A modern PHP wrapper for the YUI compressor,)
文件列表:
COPYING.txt (1297, 2014-06-03)
composer.json (384, 2014-06-03)
composer.lock (1717, 2014-06-03)
lib/ (0, 2014-06-03)
lib/YUI/ (0, 2014-06-03)
lib/YUI/Compressor.php (4223, 2014-06-03)
lib/YUI/Exception.php (289, 2014-06-03)
php-yui-compressor
==================
A modern PHP wrapper for the YUI compressor.
Installation
------------
Run `composer install` (install Composer if you haven't done so already). You will also need to have Java installed and available in your path (on Debian/Ubuntu-based systems you can install it using `sudo apt-get install default-jre`)
Usage
-----
The following snippet assumes you've included the Composer-generated autoloader.
```php
setType(\YUI\Compressor::TYPE_CSS);
$optimizedCss = $yui->compress($css);
// Compress the JavaScript
$yui->setType(\YUI\Compressor::TYPE_JS);
$optimizedScript = $yui->compress($script);
```
```php
'/usr/bin/java',
'line-break'=>80,
'disable-optimizations'=>true,
));
// Read the uncompressed contents
$css = file_get_contents('styles.css');
$script = file_get_contents('script.js');
// The "disable-optimizations" option is JavaScript-specific so it won't apply
// here...
$yui->setType(\YUI\Compressor::TYPE_CSS);
$optimizedCss = $yui->compress($css);
// ...but here it will
$yui->setType(\YUI\Compressor::TYPE_JS);
$optimizedScript = $yui->compress($script);
```
Credits
-------
Inspired by the work of gpbmike (https://github.com/gpbmike/PHP-YUI-Compressor)
近期下载者:
相关文件:
收藏者: