ganquancode / php-yui-compressor Goto Github PK
View Code? Open in Web Editor NEWphp 使用 yuicompressor 压缩或批量压缩 js和css文件的类
Home Page: php-yui-compressor
php 使用 yuicompressor 压缩或批量压缩 js和css文件的类
Home Page: php-yui-compressor
/* * PHP YUICompressor Class (Dual licensed under the MIT) * 风吟 (http://fengyin.name/guestbook.php) * DEMO http://sweet.fengyin.name/ (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);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.