如何在YUI压缩器中使用Minify PHP?

I would like to use YUI compressor with minify PHP rather than the default JSmin. Does anyone have experience setting this up?

Right now I am using the groupsConfig.php to combine the JS.

return array(
    'jsAll'  => array('//contenido/themes/bam/assets/js/jquery.js', '//contenido/themes/bam/assets/js/modernizr.js','//contenido/themes/bam/assets/js/imgpreload.js', '//contenido/themes/bam/assets/js/imgpreload.js', '//contenido/themes/bam/assets/js/history.js','//contenido/themes/bam/assets/js/ajaxify.js', '//contenido/themes/bam/assets/js/isotope.js'),
    'jsHome' => array('//contenido/themes/bam/assets/js/easing.js','//contenido/themes/bam/assets/js/scrollable.js', '//contenido/themes/bam/assets/js/home.js'),
    'cssAll' => array('//contenido/themes/bam/bam.css'),
);

As it says on the homepage:

Uses an enhanced port of Douglas Crockford's JSMin library and custom classes to minify CSS and HTML

I have the following code in config.php, but I get a 500 error when trying to view the combined js file:

function yuiJs($js) {
    require_once '/lib/Minify/YUICompressor.php'; 
    Minify_YUICompressor::$jarFile = '/lib/yuicompressor-2.4.2.jar'; 
    Minify_YUICompressor::$tempDir = '/temp'; 
    return Minify_YUICompressor::minifyJs($js); 
}
$min_serveOptions['minifiers']['application/x-javascript'] = 'yuiJs';

It also appears that there are several lines in lib/Minify/YUICompressor.php that need to be configured, and I'm not sure if I'm doing it right:

class Minify_YUICompressor {

    /**
     * Filepath of the YUI Compressor jar file. This must be set before
     * calling minifyJs() or minifyCss().
     *
     * @var string
     */
    public static $jarFile = '../yuicompressor-2.4.2.jar';

    /**
     * Writable temp directory. This must be set before calling minifyJs()
     * or minifyCss().
     *
     * @var string
     */
    public static $tempDir = '../../temp/';

    /**
     * Filepath of "java" executable (may be needed if not in shell's PATH)
     *
     * @var string
     */
    public static $javaExecutable = 'java';

I had the same problem on windows. It seems jar file needs to be executable in order to run yui compressor. So, i have to remove excutable check from YUICompressor.php

#132 


private static function _prepare()
    {
        if (! is_file(self::$jarFile)) {
            throw new Exception('Minify_YUICompressor : $jarFile('.self::$jarFile.') is not a valid file.');
        }
//         if (! is_executable(self::$jarFile)) {
//             throw new Exception('Minify_YUICompressor : $jarFile('.self::$jarFile.') is not executable.');
//         }
        if (! is_dir(self::$tempDir)) {
            throw new Exception('Minify_YUICompressor : $tempDir('.self::$tempDir.') is not a valid direcotry.');
        }
        if (! is_writable(self::$tempDir)) {
            throw new Exception('Minify_YUICompressor : $tempDir('.self::$tempDir.') is not writable.');
        }
    }

and that works fine.