1
我想使用YUI壓縮機minify PHP而不是默認的JSmin。有沒有人有經驗設置這個?如何使用YUI壓縮器來縮小PHP?
現在我正在使用groupsConfig.php來組合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'),
);
用途道格拉斯Crockford的JSMin庫和自定義類的增強端口來縮小CSS和HTML
我在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';
默認jsmin? jsmin默認在哪裏? YUI壓縮機的使用記錄在供應商主頁上:http://developer.yahoo.com/yui/compressor/ – hakre 2012-04-24 06:42:46
我修改了我的問題以澄清 – 2012-04-24 06:48:47