From e57248ca545fb290aae3baa36398d9209e4ab16b Mon Sep 17 00:00:00 2001
From: Dmitry Nezhevenko <dion@dion.org.ua>
Date: Thu, 8 Oct 2015 08:55:54 -0700
Subject: Make JSMin dependency optional

 JSMin is a JavaScript compressor. It's known to be non-free due to
 additional statement to MIT license (The Software shall be used for Good,
 not Evil.)
 .
 This patchs stubs out JSMin usage. Instead uncompressed JS will be
 returned. This should be ok since it is not default compressor at all.
Bug: https://github.com/cyberdelia/django-pipeline/issues/99
Patch-Name: make_jsmin_optional
---
 pipeline/compressors/jsmin.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pipeline/compressors/jsmin.py b/pipeline/compressors/jsmin.py
index dd1fc73..3ed6c66 100644
--- a/pipeline/compressors/jsmin.py
+++ b/pipeline/compressors/jsmin.py
@@ -9,5 +9,9 @@ class JSMinCompressor(CompressorBase):
     (http://pypi.python.org/pypi/jsmin/).
     """
     def compress_js(self, js):
-        from jsmin import jsmin
-        return jsmin(js)
+        try:
+            from jsmin import jsmin
+            return jsmin(js)
+        except ImportError:
+            # JSMin is not available
+            return js
