diff options
author | Justin Karneges <justin@affinix.com> | 2013-01-30 17:41:57 -0800 |
---|---|---|
committer | Justin Karneges <justin@affinix.com> | 2013-01-30 17:41:57 -0800 |
commit | c75ea0700ef944957051114cb347f8090249268d (patch) | |
tree | f924f8fc82ffc5b7019f20a2fa740c656ff34cf7 /compile.py | |
parent | 03689f1cc5b4ad2b77acc1d08222987f7930fffc (diff) | |
download | pollymer-c75ea0700ef944957051114cb347f8090249268d.tar pollymer-c75ea0700ef944957051114cb347f8090249268d.tar.gz |
build files
Diffstat (limited to 'compile.py')
-rwxr-xr-x | compile.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/compile.py b/compile.py new file mode 100755 index 0000000..28247eb --- /dev/null +++ b/compile.py @@ -0,0 +1,26 @@ +#!/usr/bin/python + +import httplib, urllib, sys + +# Define the parameters for the POST request and encode them in +# a URL-safe format. + +file = open(sys.argv[1]) +js_code = file.read() +file.close() + +params = urllib.urlencode([ + ('js_code', js_code), + ('compilation_level', 'SIMPLE_OPTIMIZATIONS'), + ('output_format', 'text'), + ('output_info', 'compiled_code'), + ]) + +# Always use the following value for the Content-type header. +headers = { "Content-type": "application/x-www-form-urlencoded" } +conn = httplib.HTTPConnection('closure-compiler.appspot.com') +conn.request('POST', '/compile', params, headers) +response = conn.getresponse() +data = response.read() +print data +conn.close() |