#!/usr/bin/php -q 0){ foreach($tabStyles as $name => $group){ foreach($group['list'] as $style){ } } } */ define('PATH_JS', realpath(dirname(__FILE__).'/../www/js')); define('PATH_JSMIN', realpath(dirname(__FILE__).'/../www/js/min')); define('PATH_JSGROUP', realpath(dirname(__FILE__).'/../www/js/combine')); define('USE_ENCODER', 'jsmin'); define('USE_FILEMIN', true); echo "Minify JS\n"; if(isset($tabScripts) && count($tabScripts)>0){ foreach($tabScripts as $name => $group){ echo "\nGroup $name : "; if( file_exists(PATH_JSGROUP.'/'.$name.'.js') ){ unlink(PATH_JSGROUP.'/'.$name.'.js'); } foreach($group['list'] as $script){ echo "$script "; $filejs = PATH_JS.'/'.$script; $filemin = PATH_JSGROUP.'/'.str_replace('.js', '.min.js', $script); if (USE_FILEMIN && file_exists($filemin)){ $minified = file_get_contents($filemin); } else { $js = file_get_contents($filejs); switch(USE_ENCODER){ case 'jsminplus': $minified = JSMinPlus::minify($js, $filejs.'-report'); break; case 'jsmin': default: $minified = JSMin::minify($js); break; } } file_put_contents(PATH_JSGROUP.'/'.$name.'.js', $minified, FILE_APPEND); } /* echo "\nGzip : $name\n"; if( file_exists(PATH_JSGROUP.'/'.$name.'.js.gz') ){ unlink(PATH_JSGROUP.'/'.$name.'.js.gz'); } $content = file_get_contents(PATH_JSGROUP.'/'.$name.'.js'); $compressionLevel = 9; $encodeMethod = 'gzip'; if ($encodeMethod === 'deflate') { $encoded = gzdeflate($content, $compressionLevel); } elseif ($encodeMethod === 'gzip') { $encoded = gzencode($content, $compressionLevel); } else { $encoded = gzcompress($content, $compressionLevel); } file_put_contents(PATH_JSGROUP.'/'.$name.'.js.gz', $encoded); */ } }