Changeset 1175
- Timestamp:
- 03/20/09 13:07:59 (4 years ago)
- Files:
-
- 1 modified
-
trunk/contrib/compress_yui.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/contrib/compress_yui.php
r1152 r1175 2 2 // This is script that uses the YUI compressor (http://www.julienlecomte.net/blog/2007/08/11/) 3 3 // It yields gradually better results than the dojo comressor, but it produces unreadable code 4 die("Run this script to batch-compress the current Xinha snapshot. To run the script, open the file and comment out the die() command"); 4 //die("Run this script to batch-compress the current Xinha snapshot. To run the script, open the file and comment out the die() command"); 5 6 $repository_url = 'http://svn.xinha.org/trunk'; 7 $version =''; 8 $date = date('r'); 9 10 $xinha_root = realpath(dirname(__FILE__).'/..'); 5 11 6 12 error_reporting(E_ALL); … … 48 54 return $files; 49 55 } 50 scan("../",0); 51 $cwd = getcwd(); 56 57 scan($xinha_root,0); 58 52 59 print "Processing ".count($return)." files<br />"; 53 60 54 $prefix = "/* This compressed file is part of Xinha. For uncomressed sources, forum, and bug reports, go to xinha.org */"; 61 $prefix = "/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */"; 62 if ($version) $prefix .= "\n/* This file is part of version $version released $date */"; 55 63 $core_prefix = ' 56 64 /*-------------------------------------------------------------------------- … … 60 68 -- BSD license) please read license.txt in this package for details. 61 69 -- 62 -- Copyright (c) 2005- 2009Xinha Developer Team and contributors70 -- Copyright (c) 2005-'.date('Y').' Xinha Developer Team and contributors 63 71 -- 64 72 -- Xinha was originally based on work by Mihai Bazon which is: … … 72 80 { 73 81 set_time_limit ( 60 ); 74 print "Processing $file <br />";82 print "Processing $file\n"; 75 83 flush(); 84 85 $file_url = $repository_url.str_replace($xinha_root,'',$file); 86 87 copy($file,$file."_uncompr.js"); 88 89 $file_prefix = $prefix."\n/* The URL of the most recent uncompressed version of this file is $file_url */"; 76 90 $ext = preg_replace('/.*?(\.js|\.css)$/','$1',$file); 77 91 78 92 file_put_contents($file."_uncompr${ext}", preg_replace('/(\/\/[^\n]*)?(?![*])\\\[\n]/','',file_get_contents($file))); 79 93 80 passthru("echo \"".(preg_match('/XinhaCore.js$/',$file) ? $ prefix.$core_prefix : $prefix)."\" > $file && java -jar ${cwd}/yuicompressor-2.4.2.jar --charset UTF-8 ${file}_uncompr${ext} >> $file 2>&1");94 passthru("echo \"".(preg_match('/XinhaCore.js$/',$file) ? $file_prefix.$core_prefix : $prefix)."\" > $file && java -jar {$xinha_root}/contrib/yuicompressor-2.4.2.jar --charset UTF-8 ${file}_uncompr${ext} >> $file 2>&1"); 81 95 if (preg_match('/\d+:\d+:syntax error/',file_get_contents($file))) 82 96 {
