Permalink
Browse files

add compressor

  • Loading branch information...
1 parent f8411b8 commit 49a17b35ecd94ef094021356f5bca04855911097 @gawel gawel committed Sep 5, 2009
View
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+D="fa/jquery/jquery-ui-1.7.2.custom";
+CMD="python compressor.py -c $HOME/jar/yuicompressor-2.4.2.jar "
+$CMD -o $D/fa.jquery.min.css -t css $(find $D -mindepth 2 -maxdepth 2 -name "*.css")
+$CMD -o $D/fa.jquery.min.js $(find $D/js -name "*.js") $(find $D/co* -name "*.js")
View
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+__doc__ = "require http://yuilibrary.com/downloads/#yuicompressor in ~/jar/"
+import sys
+import subprocess
+import os, os.path, shutil
+from optparse import OptionParser
+
+
+parser = OptionParser()
+parser.add_option("-c", "--compressor", dest="compressor",
+ help="path to yuicompressor")
+parser.add_option("-o", "--output", dest="out_file",
+ help="Output file")
+parser.add_option("-t", "--type", dest="in_type",
+ default='js', help="js / css")
+parser.add_option("-v", "--verbose", dest="verbose",
+ action="store_true", default=False,
+ help="Output file")
+
+def main(args=None):
+ opts, paths = parser.parse_args(args or sys.argv[1:])
+ out_file = opts.out_file
+ in_type = opts.in_type
+
+ in_files = []
+
+ if not out_file or not paths or not opts.compressor:
+ parser.parse_args(['-h'])
+
+ temp_file = '/tmp/compressor.tmp'
+
+ for p in paths:
+ if '*' in p:
+ in_files.extend(glob.glob(p))
+ else:
+ in_files.append(p)
+
+ temp = open(temp_file, 'wb')
+ for f in in_files:
+ fh = open(f)
+ data = fh.read() + '\n'
+ fh.close()
+
+ temp.write(data)
+
+ print '+ %s' % f
+ temp.close()
+
+ options = ['-o "%s"' % out_file,
+ '--type %s' % in_type]
+
+ if opts.verbose:
+ options.append('-v')
+
+ subprocess.call('java -jar "%s" %s "%s"' % (opts.compressor,
+ ' '.join(options),
+ temp_file), shell=True)
+
+ org_size = os.path.getsize(temp_file)
+ new_size = os.path.getsize(out_file)
+
+ print '=> %s' % out_file
+ print 'Original: %.2f kB' % (org_size / 1024.0)
+ print 'Compressed: %.2f kB' % (new_size / 1024.0)
+ print 'Reduction: %.1f%%' % (float(org_size - new_size) / org_size * 100)
+ print ''
+
+if __name__ == '__main__':
+ main()
+
@@ -0,0 +1 @@
+.jColorSelect{overflow:hidden;border:1px solid #d9dcdd;}.jColorSelect div{background:url(syronex-colorpicker.gif) no-repeat;float:left;width:13px;height:13px;cursor:pointer;overflow:hidden;border:1px solid #666;margin:1px;}.jColorSelect .checkwht{cursor:default;background-position:-13px 0;}.jColorSelect .checkblk{cursor:default;background-position:-26px 0;}.ac_results{padding:0;border:1px solid black;background-color:white;overflow:hidden;z-index:99999;}.ac_results ul{width:100%;list-style-position:outside;list-style:none;padding:0;margin:0;}.ac_results li{margin:0;padding:2px 5px;cursor:default;display:block;font:menu;font-size:12px;line-height:16px;overflow:hidden;}.ac_loading{background:white url('indicator.gif') right center no-repeat;}.ac_odd{background-color:#eee;}.ac_over{background-color:#0A246A;color:white;}
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,4 +1,4 @@
-<input type="text" size="10" value="${value}" id="${name}" name="${name}" />
+<input type="text" autocomplete="off" size="10" value="${value}" id="${name}" name="${name}" />
<script type="text/javascript">
jQuery(document.getElementById('${name}')).datepicker(${jq_options});
</script>
@@ -4,12 +4,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>jQuery UI Example Page</title>
<link type="text/css" href="/jquery_ui/css/redmond/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
- <link type="text/css" href="/jquery_ui/css/jquery.autocomplete.css" rel="stylesheet" />
- <link type="text/css" href="/jquery_ui/colorpicker/syronex-colorpicker.css" rel="stylesheet" />
- <script type="text/javascript" src="/jquery_ui/js/jquery-1.3.2.min.js"></script>
- <script type="text/javascript" src="/jquery_ui/js/jquery-ui-1.7.2.custom.min.js"></script>
- <script type="text/javascript" src="/jquery_ui/js/jquery.autocomplete.js"></script>
- <script type="text/javascript" src="/jquery_ui/colorpicker/syronex-colorpicker.js"></script>
+ <link type="text/css" href="/jquery_ui/fa.jquery.min.css" rel="stylesheet" />
+ <script type="text/javascript" src="/jquery_ui/fa.jquery.min.js"></script>
<script type="text/javascript">
$(function(){

0 comments on commit 49a17b3

Please sign in to comment.