With this plugin, you can minify you js's and css's via PHP providing input and output path's. Also you can minify and merge all your code in one file. This scripts are using Andy Chilton API's.
You can find dashboard example https://github.com/DanRotaru/Minifier-JS-CSS/tree/master/minify
require "minifier.class.php";
// Minify JS code
Minifier::minifyFile("/public/js/app.js", "/public/js/app.min.js");
// Minify CSS code
Minifier::minifyFile("/public/css/app.css", "/public/css/app.min.css");
You also can minify all files by extension, you can minify all and merge them in one. Ex: You have 4 files: header.js, main.js, function.js, footer.js You can minify all and merge them in one: all.js In output will be created minified file all.js that will contain all these files.
// Minify all files with .js extension from directory /public/js/components/ into file /public/js/all.js
Minifier::minifyDir("/public/js/components", "/public/js/all.js");
// Minify all files with .css extension from directory /public/css/components/ into file /public/css/all.css
Minifier::minifyDir("/public/css/components/", "/public/css/all.css");
// Get file content
$content = file_get_contents("/public/js/app.js");
// Get minified content get($content, $language = "js" || "css")
$minfied = Minifier::get($content, "js");
echo $minfied;
- PHP Web Server
Released under the MIT license.
Created by DanRotaru.