Home » Source Code » php 使用 yui compressor 压缩或批量压缩 js和css文件的类

php 使用 yui compressor 压缩或批量压缩 js和css文件的类

dai1988
2016-05-18 18:36:13
The author
View(s):
Download(s): 0
Point (s): 1 
Category Category:
AllAll

Description

closure-complier-class/


演示地址(DEMO) http://ganquan.info/yui/ (yui online compressor)

php 使用 yuicompressor 压缩或批量压缩 js和css类.

本类通过 windows 和 linux平台测试 有任何问题请反馈到:http://ganquan.info/

使用方式:

``` /* * PHP YUICompressor Class (Dual licensed under the MIT) * 风吟 (http://ganquan.info/) * DEMO http://ganquan.info/yui/ (yui online compressor) ---------------------------------------------------------- 要求: dk 1.4+ php exec() 作用: 使用 yuicompressor 批量压缩一个目录的 js 或者 css 文件.也可以对单个文件进行压缩 ----------------------------------------------------------

//Windows 调用方式:

$yui = new yuicompressor(array( 'java_home'=>'java', //或自己指定 jdk 安装的 bin 目录 (绝对路径) 'jar_file'=>'D:\www\htdocs\yuicompressor.jar', 'save_path'=>'D:\www\htdocs\results\', //必须有可写权限 // -------- 全局设置 --------- // 'charset'=>'utf-8', //文件的编码 'line-break'=>false, //在指定的列后插入一个 line-bread 符号 // -------- javascript 代码的配置选项 --------- // 'nomunge'=>false, //只是简单压缩,清除空行空格注释等。 'semi'=>false, //保留所有的分号 'optimizations'=>false, //禁止优化代码. ));

//对单个文件压缩 $resutlt = $yui->compress('D:\www\htdocs\swfobject_src.js'); print_r ($resutlt);

//对目录文件压缩 $resutlt = $yui->directory('D:\www\htdocs\'); print_r($resutlt);


//Linux 调用方式:

$yui = new yuicompressor(array( 'java_home'=>'java', //或自己指定 jdk 安装的 bin 目录 (绝对路径) 'jar_file'=>'/home/admin/yuicompressor-2.4.2.jar', 'save_path'=>'/home/admin/results/', //必须有可写权限 // -------- 全局设置 --------- // 'charset'=>'utf-8', //文件的编码 'line-break'=>false, //在指定的列后插入一个 line-bread 符号 // -------- javascript 代码的配置选项 --------- // 'nomunge'=>false, //只是简单压缩,清除空行空格注释等。 'semi'=>false, //保留所有的分号 'optimizations'=>false, //禁止优化代码. ));

//对单个文件压缩 $resutlt = $yui->compress('/home/admin/style.css'); print_r ($resutlt);

//对目录文件压缩 $resutlt = $yui->directory('/home/admin/'); print_r($resutlt);

*/ ```

Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
0.00 B
Sponsored links

Comments

(Add your comment, get 0.1 Point)
Minimum:15 words, Maximum:160 words
  • 1
  • Page 1
  • Total 1

php 使用 yui compressor 压缩或批量压缩 js和css文件的类 (4.44 kB)

Need 1 Point(s)
Your Point (s)

Your Point isn't enough.

Get 22 Point immediately by PayPal

Point will be added to your account automatically after the transaction.

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more Points

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D