File: compress.py

package info (click to toggle)
jquery-i18n-properties 1.2.7%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 1,780 kB
  • sloc: javascript: 298; makefile: 17; python: 16
file content (28 lines) | stat: -rw-r--r-- 770 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python

import httplib, urllib, sys

# Define the parameters for the POST request and encode them in
# a URL-safe format.
f = open('jquery.i18n.properties.js', 'r')

params = urllib.urlencode([
    #('js_code', sys.argv[1]),
    ('js_code', f.read()),
    ('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
f2 = open('jquery.i18n.properties.min.js', 'w')
f2.write(data)

conn.close