Adding support for closure compiler and some documentation

in the README about how to use it.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@11448 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2011-02-24 23:19:53 +00:00
parent 8d2bbfe28f
commit d06c66edab
4 changed files with 67 additions and 8 deletions

21
tools/closure.py Normal file
View File

@@ -0,0 +1,21 @@
import sys
import os
import tempfile
path = os.path.join(os.path.dirname(__file__), "closure-compiler.jar")
if not os.path.exists(path):
raise Exception("No closure-compiler.jar at %s; read README.txt!" % path)
def minimize(code):
ntf = tempfile.NamedTemporaryFile()
ntf.write(code)
ntf.flush()
ntf2 = tempfile.NamedTemporaryFile()
os.system("java -jar %s --js %s --js_output_file %s" % (path, ntf.name, ntf2.name))
ntf2.seek(0)
data = ntf2.read()
ntf.close()
ntf2.close()
return data