<?php
$js = file_get_contents($_GET['f']);
$md = md5($js); // you can use sth faster, such as date comparsion
if (file_exists('cache/'.$md.'.js')) {
echo file_get_contents('cache/'.$md.'.js');
} else {
$min = yourJsMinifierFunc($js);
file_put_contents('cache/'.$md.'.js', $min);
echo $min;
}
Implement it with a cache system
e.g. 1
e.g. 2: