Skip to content

Commit

Permalink
Changed to use online CSS minifier, fixes issues with local Python ve…
Browse files Browse the repository at this point in the history
…rsion
  • Loading branch information
jeremypoulter committed Aug 31, 2017
1 parent 8904ab9 commit 65c9b34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions scripts/extra_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pprint import pprint

from css_html_js_minify.html_minifier import html_minify
from css_html_js_minify.css_minifier import css_minify
#from css_html_js_minify.css_minifier import css_minify
#from css_html_js_minify.js_minifier import js_minify

Import("env")
Expand All @@ -25,14 +25,23 @@ def js_minify(original):
])

# Always use the following value for the Content-type header.
headers = { "Content-type": "application/x-www-form-urlencoded" }
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()
conn.close()
return data

import requests

def css_minify(original, wrap=False, comments=False, sort=True):
url = 'https://cssminifier.com/raw'
data = {'input': original }
response = requests.post(url, data=data)

return response.text

def minify(env, target, source):
output = ""
for source_file in source:
Expand Down
2 changes: 1 addition & 1 deletion src/data/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 65c9b34

Please sign in to comment.