makessites / uglifyjs-php
使用 UglifyJS 作为 PHP 中 JavaScript 压缩的服务
0.5.0
2015-10-05 17:14 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-18 10:48:55 UTC
README
使用 UglifyJS 作为 PHP 中 JavaScript 压缩的服务
注意,此类封装了对由 UglifyJS-service 运行的远程服务的请求
用法
$compiler = new UglifyJS(); $compiler->add("js/my-app.js") ->add("js/popup.js") ->cacheDir("/tmp/js-cache/") ->write();
API
以下是执行的主要方法
cacheDir( $path )
设置缓存的临时目录。
compiler( $url )
设置编译器的位置为完整的 URL(包括端口)。默认为 http://marijnhaverbeke.nl:80/uglifyjs
add( $script )
将脚本添加到待压缩的队列中。
write( $output );
解析队列并压缩文件。如果 $output=true
,则可选地输出结果(默认:false)
致谢
由 Makis Tracend ( @tracend ) 创建
通过 Makesites.org 分发
趣事
- 最初是为了成为 KISSCMS 的一部分而创建
- 基于 Daniel Pupius 的 PHP Closure
许可证
在 Apache License v2.0 下发布