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
2c68d7be
Commit
2c68d7be
authored
Oct 22, 2012
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change cssmin compressor
parent
5ca05981
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
17 deletions
+26
-17
docs/compressors.rst
+18
-7
pipeline/compressors/cssmin.py
+5
-10
pipeline/conf/settings.py
+3
-0
No files found.
docs/compressors.rst
View file @
2c68d7be
...
...
@@ -158,18 +158,29 @@ To us it for your stylesheets add this to your ``PIPELINE_CSS_COMPRESSOR`` ::
Default to ``'--template=highest'``
cssm
in compressor
CSSM
in compressor
=================
The cssmin compressor uses the `cssmin <http://pypi.python.org/pypi/cssmin/>`_
Python library to compress stylesheets. To use it, specify this
``PIPELINE_CSS_COMPRESSOR`` ::
The cssmin compressor uses the `cssmin <https://github.com/jbleuzen/node-cssmin>`_
command to compress stylesheets. To use it, add this to your ``PIPELINE_CSS_COMPRESSOR`` ::
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.cssmin.C
ssm
inCompressor'
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.cssmin.C
SSM
inCompressor'
Install the cssmin library with your favorite Python package manager. E.g. ::
``PIPELINE_CSSMIN_BINARY``
---------------------------
Command line to execute for cssmin program.
You will most likely change this to the location of cssmin on your system.
Defaults to ``'/usr/bin/env cssmin'``
``PIPELINE_CSSMIN_ARGUMENTS``
------------------------------
Additional arguments to use when cssmin is called.
Default to ``''``
pip install cssmin
Write your own compressor class
===============================
...
...
pipeline/compressors/cssmin.py
View file @
2c68d7be
from
__future__
import
absolute_import
from
pipeline.conf
import
settings
from
pipeline.compressors
import
SubProcessCompressor
from
pipeline.compressors
import
CompressorBase
class
CssminCompressor
(
CompressorBase
):
"""
CSS compressor based on the Python library cssmin
(http://pypi.python.org/pypi/cssmin/).
"""
class
CSSMinCompressor
(
SubProcessCompressor
):
def
compress_css
(
self
,
css
):
from
cssmin
import
cssmin
return
cssmin
(
css
)
command
=
"
%
s
%
s"
%
(
settings
.
PIPELINE_CSSMIN_BINARY
,
settings
.
PIPELINE_CSSMIN_ARGUMENTS
)
return
self
.
execute_command
(
command
,
css
)
pipeline/conf/settings.py
View file @
2c68d7be
...
...
@@ -37,6 +37,9 @@ PIPELINE_CLOSURE_ARGUMENTS = getattr(settings, 'PIPELINE_CLOSURE_ARGUMENTS', '')
PIPELINE_UGLIFYJS_BINARY
=
getattr
(
settings
,
'PIPELINE_UGLIFYJS_BINARY'
,
'/usr/bin/env uglifyjs'
)
PIPELINE_UGLIFYJS_ARGUMENTS
=
getattr
(
settings
,
'PIPELINE_UGLIFYJS_ARGUMENTS'
,
''
)
PIPELINE_CSSMIN_BINARY
=
getattr
(
settings
,
'PIPELINE_CSSMIN_BINARY'
,
'/usr/bin/env cssmin'
)
PIPELINE_CSSMIN_ARGUMENTS
=
getattr
(
settings
,
'PIPELINE_CSSMIN_ARGUMENTS'
,
''
)
PIPELINE_COFFEE_SCRIPT_BINARY
=
getattr
(
settings
,
'PIPELINE_COFFEE_SCRIPT_BINARY'
,
'/usr/bin/env coffee'
)
PIPELINE_COFFEE_SCRIPT_ARGUMENTS
=
getattr
(
settings
,
'PIPELINE_COFFEE_SCRIPT_ARGUMENTS'
,
''
)
...
...
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