iflen(merged)>1000000:# The maximum file size for this web service is 1000 KB.
print"\nPre-compressing using jsmin"
merged=jsmin.jsmin(merged)
print"\nIs being compressed using Closure Compiler Service."
try:
minimized=closure_ws.minimize(merged)
exceptException,E:
print"\nAbnormal termination."
sys.exit("ERROR: Closure Compilation using Web service failed!\n%s"%E)
iflen(minimized)<=2:
print"\nAbnormal termination due to compilation errors."
sys.exit("ERROR: Closure Compilation using Web service failed!")
else:
print'\nClosure Compilation using Web service has completed successfully.'
elifuse_compressor=="closure":
minimized=closure.minimize(merged)
else:# fallback
minimized=merged
print"Adding license file."
minimized=file("license.txt").read()+minimized
@@ -33,3 +83,16 @@ print "Writing to %s." % outputFilename
file(outputFilename,"w").write(minimized)
print"Done."
if__name__=='__main__':
opt=optparse.OptionParser(usage="%s [options] [config_file] [output_file]\n Default config_file is 'full.cfg', Default output_file is 'OpenLayers.js'")
opt.add_option("-c","--compressor",dest="compressor",help="compression method: one of 'jsmin', 'minimize', 'closure_ws', 'closure', or 'none'",default="jsmin")