* minify for mobile js and css.
This commit is contained in:
@@ -31,6 +31,21 @@ file_put_contents($allJSFile, $jsCode);
|
||||
/* Compress it. */
|
||||
`java -jar ~/bin/yuicompressor/build/yuicompressor.jar --type js $allJSFile -o $allJSFile`;
|
||||
|
||||
/* Set mobile js files to combined. */
|
||||
$mobileJsFiles[] = $jqueryRoot . 'mobile/jquery-1.10.1.min.js';
|
||||
$mobileJsFiles[] = $jsRoot . 'm.my.full.js';
|
||||
$mobileJsFiles[] = $jqueryRoot . 'mobile/jquery.mobile.min.js';
|
||||
$mobileJsFiles[] = $jqueryRoot . 'jquery.pjax.js';
|
||||
|
||||
/* Combine these js files. */
|
||||
$allJSFile = $jsRoot . 'm.all.js';
|
||||
$jsCode = '';
|
||||
foreach($mobileJsFiles as $jsFile) $jsCode .= "\n". file_get_contents($jsFile);
|
||||
file_put_contents($allJSFile, $jsCode);
|
||||
|
||||
/* Compress it. */
|
||||
`java -jar ~/bin/yuicompressor/build/yuicompressor.jar --type js $allJSFile -o $allJSFile`;
|
||||
|
||||
//-------------------------------- PROCESS CSS FILES ------------------------------ //
|
||||
|
||||
/* Define the themeRoot. */
|
||||
@@ -72,3 +87,21 @@ foreach($langs as $lang)
|
||||
`java -jar ~/bin/yuicompressor/build/yuicompressor.jar --type css $cssFile -o $cssFile`;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create css files for every them and every lang. */
|
||||
foreach($langs as $lang)
|
||||
{
|
||||
/* Common css files. */
|
||||
$cssCode = file_get_contents($themeRoot . 'default/jquery.mobile.css');
|
||||
$cssCode .= file_get_contents($themeRoot . 'default/m.style.css');
|
||||
|
||||
/* Css file for current lang and current them. */
|
||||
$cssCode .= file_get_contents($themeRoot . "lang/$lang.css");
|
||||
|
||||
/* Combine them. */
|
||||
$cssFile = $themeRoot . "default/m.$lang.default.css";
|
||||
file_put_contents($cssFile, $cssCode);
|
||||
|
||||
/* Compress it. */
|
||||
`java -jar ~/bin/yuicompressor/build/yuicompressor.jar --type css $cssFile -o $cssFile`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user