secomapp / uglifyjs-php
Using UglifyJS as a service for JavaScript minification in PHP
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 8
Language:JavaScript
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-11-15 19:42:13 UTC
README
Using UglifyJS as a service for JavaScript minification in PHP
Note that this class is abstructing the requests to a remote service run by an UglifyJS-service
Usage
$compiler = new UglifyJS();
$compiler->add("js/my-app.js")
->add("js/popup.js")
->cacheDir("/tmp/js-cache/")
->write();
API
These are the main methods to execute:
cacheDir( $path )
Setting the temp dir for the cached files.
compiler( $url )
Setting the compiler location as a full url (including port) . Defaults to http://marijnhaverbeke.nl:80/uglifyjs
add( $script )
Add a script in the queue to be compressed.
write( $output );
Parsing queue and compressing files. Optionally outputting the result if $output=true
(default: false)
Credits
Created by Makis Tracend ( @tracend )
Distributed through Makesites.org
Trivia
- Originally created to be part of KISSCMS
- Based on PHP Closure by Daniel Pupius
License
Released under the Apache License v2.0