Created
August 2, 2013 05:07
-
-
Save umidjons/6137647 to your computer and use it in GitHub Desktop.
Compress JavaScript file with JSMin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // -- Test JSMin | |
| require( 'min/lib/JSMin.php' ); | |
| $file = 'jquery-1.10.2.js'; | |
| $pi = pathinfo( $file ); | |
| $filemin = $pi[ 'filename' ] . '-jsmin.' . $pi[ 'extension' ]; | |
| if ( file_exists( $file ) ) { | |
| $source = file_get_contents( $file ); | |
| $res = JSMin::minify( $source ); | |
| file_put_contents( $filemin, $res ); | |
| printf("File size: %d Minified file size: %d", @filesize( $file ), @filesize( $filemin ) ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment