From dca15157e6ff4353f89bc0d39ff035979b4993af Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Fri, 31 Aug 2012 06:40:22 +0000 Subject: [PATCH] + add the files to combine and minify css and js files. --- bin/minifyfront.php | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 bin/minifyfront.php diff --git a/bin/minifyfront.php b/bin/minifyfront.php new file mode 100644 index 0000000000..13dadb688e --- /dev/null +++ b/bin/minifyfront.php @@ -0,0 +1,70 @@ +langs); +$themes = array_keys($lang->themes); + +/* Create css files for every them and every lang. */ +foreach($langs as $lang) +{ + foreach($themes as $theme) + { + /* Common css files. */ + $cssCode = file_get_contents($themeRoot . 'default/yui.css'); + $cssCode .= file_get_contents($themeRoot . 'default/style.css'); + $cssCode .= file_get_contents($themeRoot . 'default/colorbox.css'); + $cssCode .= file_get_contents($themeRoot . 'default/chosen.css'); + $cssCode .= file_get_contents($themeRoot . 'default/treeview.css'); + $cssCode .= file_get_contents($themeRoot . 'default/datepicker.css'); + $cssCode .= file_get_contents($themeRoot . 'default/alert.css'); + + /* Css file for current lang and current them. */ + $cssCode .= file_get_contents($themeRoot . "lang/$lang.css"); + if($theme != 'default') $cssCode .= file_get_contents($themeRoot . $theme . '/style.css'); + + /* Combine them. */ + $cssFile = $themeRoot . "default/$lang.$theme.css"; + file_put_contents($cssFile, $cssCode); + + /* Compress it. */ + `java -jar ~/bin/yuicompressor/build/yuicompressor.jar --type css $cssFile -o $cssFile`; + } +}