2012-04-24 4 views
1

デフォルトのJSminではなくminify PHPのYUIコンプレッサーを使用したいと思います。誰もがこれを設定する経験がありますか?YUIコンプレッサでMinify PHPを使用するには?

今はgroupsConfig.phpを使用してJSを結合しています。 it says on the homepageとして

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'), 
); 

は、CSSとHTML

を縮小化するためにダグラス・クロックフォードのJSMinライブラリとカスタムクラスの拡張ポートを使用して、私のconfig.phpに以下のコードを持っていますが、結合されたjsファイルを表示しようとすると500エラーが表示されます。

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'; 

また、構成する必要があるのlib /縮小化/ YUICompressor.phpで複数の行があることが表示され、私は右のそれをやっている場合、私はよく分からない。私は同じ問題を抱えていた

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'; 
+0

デフォルトのjsmin? jsminはどこにデフォルト設定されていますか? YUIコンプレッサの使用方法は、ベンダーのホームページに記載されています。http://developer.yahoo.com/yui/compressor/ – hakre

+0

私は質問を明確にするために変更しました –

答えて

0

を窓にyui圧縮プログラムを実行するには、jarファイルを実行可能にする必要があります。だから、私は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.'); 
     } 
    } 

これは問題なく動作します。

関連する問題