Skip to content

Commit

Permalink
Check HTTP status of minifying tools
Browse files Browse the repository at this point in the history
  • Loading branch information
da2x committed Nov 19, 2015
1 parent dbb28e9 commit 36f5e4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -9,6 +9,7 @@ Features
Bugfixes
--------

* Check HTTP response status of minifying tools and skip them if they’re unavailable
* Change rewrite rule for fragment-only links (Issue #2132)
* Mention disabled plugins in ``nikola plugin --list-installed`` (Issue #2139)
* Don't examine all gallery image dates every build (Issue #2160)
Expand Down
6 changes: 6 additions & 0 deletions nikola/filters.py
Expand Up @@ -290,6 +290,9 @@ def cssminify(data):
url = 'http://cssminifier.com/raw'
_data = {'input': data}
response = requests.post(url, data=_data)
if response.status_code != 200:
LOGGER.error("can't use cssminifier.com: HTTP status {}", response.status_code)
return data
return response.text
except Exception as exc:
LOGGER.error("can't use cssminifier.com: {}", exc)
Expand All @@ -303,6 +306,9 @@ def jsminify(data):
url = 'http://javascript-minifier.com/raw'
_data = {'input': data}
response = requests.post(url, data=_data)
if response.status_code != 200:
LOGGER.error("can't use javascript-minifier.com: HTTP status {}", response.status_code)
return data
return response.text
except Exception as exc:
LOGGER.error("can't use javascript-minifier.com: {}", exc)
Expand Down

0 comments on commit 36f5e4d

Please sign in to comment.