├── minify.php ├── README.md ├── LICENSE └── minifier.php /minify.php: -------------------------------------------------------------------------------- 1 |
2 | 'js/main.min.js', 11 | // ... 12 | ]; 13 | 14 | $css = [ 15 | 'css/main.css' => 'css/main.min.css', 16 | // ... 17 | ]; 18 | 19 | minifyJS($js); 20 | minifyCSS($css); 21 | ?> 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PHP, JS and CSS Minifier 2 | ==================== 3 | 4 | ## Description 5 | With this plugin, you can minify you js's and css's via PHP providing input and output path's. 6 | This plugin uses an online service provided by Andy Chilton, http://chilts.org/ 7 | 8 | ## Download 9 | * [Master branch](https://github.com/promatik/php-js-css-minifier/archive/master.zip) 10 | 11 | ## Setup 12 | * How to setup the plugin: 13 | 14 | ```php 15 | include_once 'minifier.php'; 16 | 17 | $js = [ 18 | 'js/main.js' => 'js/main.min.js', 19 | // ... 20 | ]; 21 | $css = [ 22 | 'css/main.css'=> 'css/main.min.css', 23 | // ... 24 | ]; 25 | 26 | minifyJS($js); 27 | minifyCSS($css); 28 | ``` 29 | 30 | ## Features 31 | * **Instantly compress all your JS's and CSS's** 32 | This allows you to add js and css files to a list, that you can minify at any time. 33 | 34 | ## Requirements 35 | * PHP Webserver 36 | 37 | ## License 38 | Released under the [MIT license](http://www.opensource.org/licenses/MIT). 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 António Almeida 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /minifier.php: -------------------------------------------------------------------------------- 1 | $value) { 32 | $handler = fopen($value, 'w') or die("File ".$value.' error!