def compress(body, filename): print 'Compressing to %s...' % (filename, ), ext = filename.split('.')[-1] args = split('java -jar tools/yuicompressor-2.4.7.jar -o %s --charset utf-8 --type %s' % (filename, ext)) p = Popen(args, stdin=PIPE) out, err = p._communicate(body) rc = p.wait() if rc: print out print err exit(1) else: print 'done'
def compress(body, filename): print 'Compressing to %s...' % (filename, ), ext = filename.split('.')[-1] args = split( 'java -jar tools/yuicompressor-2.4.7.jar -o %s --charset utf-8 --type %s' % (filename, ext)) p = Popen(args, stdin=PIPE) out, err = p._communicate(body) rc = p.wait() if rc: print out print err exit(1) else: print 'done'