Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
0da6b493
Commit
0da6b493
authored
May 22, 2013
by
Carl Meyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PIPELINE_ENABLED setting.
parent
f191794e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
4 deletions
+13
-4
docs/configuration.rst
+7
-0
pipeline/conf/settings.py
+2
-0
pipeline/manifest.py
+1
-1
pipeline/templatetags/compressed.py
+1
-1
tests/tests/test_extension.py
+2
-2
No files found.
docs/configuration.rst
View file @
0da6b493
...
...
@@ -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``
............................
...
...
pipeline/conf/settings.py
View file @
0da6b493
...
...
@@ -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
)
...
...
pipeline/manifest.py
View file @
0da6b493
...
...
@@ -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
))
...
...
pipeline/templatetags/compressed.py
View file @
0da6b493
...
...
@@ -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
:
...
...
tests/tests/test_extension.py
View file @
0da6b493
...
...
@@ -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_d
ebug
(
self
):
with
pipeline_settings
(
DEBUG
=
Tru
e
):
def
test_package_css_d
isabled
(
self
):
with
pipeline_settings
(
PIPELINE_ENABLED
=
Fals
e
):
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" />
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment