Skip to content

Instantly share code, notes, and snippets.

@daviferreira
Created September 1, 2011 13:12
Show Gist options
  • Save daviferreira/1186136 to your computer and use it in GitHub Desktop.
Save daviferreira/1186136 to your computer and use it in GitHub Desktop.
Python minifier using Reducisaurus
import httplib, urllib
origin = 'file.js'
destination = 'file.min.js'
params = urllib.urlencode({'file1': open(origin).read()})
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
conn = httplib.HTTPConnection('reducisaurus.appspot.com')
conn.request('POST', '/js', params, headers)
response = conn.getresponse()
data = response.read()
conn.close()
f = open(destination, 'w')
f.write(data)
f.close()
print 'Minified version saved as %s.' % destination
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment