Commit 0da6b493 by Carl Meyer

Add PIPELINE_ENABLED setting.

parent f191794e
......@@ -105,6 +105,13 @@ Group options
Other settings
--------------
``PIPELINE_ENABLED``
....................
``True`` if assets should be compressed, ``False`` if not.
Defaults to ``not settings.DEBUG``.
``PIPELINE_CSS_COMPRESSOR``
............................
......
......@@ -4,6 +4,8 @@ from django.conf import settings
DEBUG = getattr(settings, 'DEBUG', False)
PIPELINE_ENABLED = getattr(settings, 'PIPELINE_ENABLED', not DEBUG)
PIPELINE_ROOT = getattr(settings, 'PIPELINE_ROOT', settings.STATIC_ROOT)
PIPELINE_URL = getattr(settings, 'PIPELINE_URL', settings.STATIC_URL)
......
......@@ -33,7 +33,7 @@ class PipelineManifest(Manifest):
def cache(self):
ignore_patterns = getattr(settings, "STATICFILES_IGNORE_PATTERNS", None)
if not settings.DEBUG:
if settings.PIPELINE_ENABLED:
for package in self.packages:
self.package_files.append(package.output_filename)
yield str(self.packager.individual_url(package.output_filename))
......
......@@ -30,7 +30,7 @@ class CompressedMixin(object):
return packager.package_for(package_type, package_name)
def render_compressed(self, package, package_type):
if not settings.DEBUG:
if settings.PIPELINE_ENABLED:
method = getattr(self, "render_{0}".format(package_type))
return method(package, package.output_filename)
else:
......
......@@ -25,8 +25,8 @@ class ExtensionTest(TestCase):
template = self.env.from_string(u"""{% compressed_css "screen" %}""")
self.assertEqual(u'<link href="/static/screen.css" rel="stylesheet" type="text/css" />', template.render())
def test_package_css_debug(self):
with pipeline_settings(DEBUG=True):
def test_package_css_disabled(self):
with pipeline_settings(PIPELINE_ENABLED=False):
template = self.env.from_string(u"""{% compressed_css "screen" %}""")
self.assertEqual(u'''<link href="/static/pipeline/css/first.css" rel="stylesheet" type="text/css" />
<link href="/static/pipeline/css/second.css" rel="stylesheet" type="text/css" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment