good_evening
good_evening

Reputation: 21749

PHP auto minify. Is there any?

I use PHP Minify and it's great. But my question, is there any PHP plugin or something, which would automatically detect javascript/css code and minify it automatically? Thank you.

Upvotes: 2

Views: 2479

Answers (2)

aWebDeveloper
aWebDeveloper

Reputation: 38352

Do look at https://github.com/web-developer/Resource-Handler. This is a on the fly compressor and minifyer for your js. This requires least configuration or hassle, unlike the other one suggested .

RESOURCE HANDLER

Upvotes: 0

genesis
genesis

Reputation: 50976

Javascript minifier?

Take a look here

require_once('jsmin-1.1.1.php');

$files = glob("/path/to/js/merge/*.js");
$js = "";
foreach($files as $file) {
    $js .= JSMin::minify(file_get_contents($file));
}

file_put_contents("/path/to/js/combined.js", $js);
// or to output it: echo $js;

Upvotes: 2

Related Questions