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
7b105bed
Commit
7b105bed
authored
Jul 11, 2012
by
Brant Young
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add SlimIt (
http://slimit.org/
) compressor
parent
2b8dc5cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
14 deletions
+42
-14
docs/compressors.rst
+29
-14
pipeline/compressors/slimit.py
+13
-0
No files found.
docs/compressors.rst
View file @
7b105bed
...
@@ -9,7 +9,7 @@ YUI Compressor compressor
...
@@ -9,7 +9,7 @@ YUI Compressor compressor
=========================
=========================
The YUI compressor uses `yui-compressor <http://developer.yahoo.com/yui/compressor/>`_
The YUI compressor uses `yui-compressor <http://developer.yahoo.com/yui/compressor/>`_
for compressing javascript and stylesheets.
for compressing javascript and stylesheets.
To use it for your stylesheets add this to your ``PIPELINE_CSS_COMPRESSOR`` ::
To use it for your stylesheets add this to your ``PIPELINE_CSS_COMPRESSOR`` ::
...
@@ -25,12 +25,12 @@ To use it for your javascripts add this to your ``PIPELINE_JS_COMPRESSOR`` ::
...
@@ -25,12 +25,12 @@ To use it for your javascripts add this to your ``PIPELINE_JS_COMPRESSOR`` ::
Command line to execute for the YUI program.
Command line to execute for the YUI program.
You will most likely change this to the location of yui-compressor on your system.
You will most likely change this to the location of yui-compressor on your system.
Defaults to ``'/usr/local/bin/yuicompressor'``.
Defaults to ``'/usr/local/bin/yuicompressor'``.
.. warning::
.. warning::
Don't point to ``yuicompressor.jar`` directly, we expect to find a executable script.
Don't point to ``yuicompressor.jar`` directly, we expect to find a executable script.
``PIPELINE_YUI_CSS_ARGUMENTS``
``PIPELINE_YUI_CSS_ARGUMENTS``
------------------------------
------------------------------
...
@@ -43,7 +43,7 @@ To use it for your javascripts add this to your ``PIPELINE_JS_COMPRESSOR`` ::
...
@@ -43,7 +43,7 @@ To use it for your javascripts add this to your ``PIPELINE_JS_COMPRESSOR`` ::
-----------------------------
-----------------------------
Additional arguments to use when compressing JavaScript.
Additional arguments to use when compressing JavaScript.
Defaults to ``''``.
Defaults to ``''``.
...
@@ -65,7 +65,7 @@ To use it add this to your ``PIPELINE_JS_COMPRESSOR`` ::
...
@@ -65,7 +65,7 @@ To use it add this to your ``PIPELINE_JS_COMPRESSOR`` ::
Command line to execute for the Closure Compiler program.
Command line to execute for the Closure Compiler program.
You will most likely change this to the location of closure on your system.
You will most likely change this to the location of closure on your system.
Default to ``'/usr/local/bin/closure'``
Default to ``'/usr/local/bin/closure'``
.. warning::
.. warning::
...
@@ -76,7 +76,7 @@ To use it add this to your ``PIPELINE_JS_COMPRESSOR`` ::
...
@@ -76,7 +76,7 @@ To use it add this to your ``PIPELINE_JS_COMPRESSOR`` ::
------------------------------
------------------------------
Additional arguments to use when closure is called.
Additional arguments to use when closure is called.
Default to ``''``
Default to ``''``
...
@@ -96,14 +96,14 @@ To use it add this to your ``PIPELINE_JS_COMPRESSOR`` ::
...
@@ -96,14 +96,14 @@ To use it add this to your ``PIPELINE_JS_COMPRESSOR`` ::
Command line to execute for the Closure Compiler program.
Command line to execute for the Closure Compiler program.
You will most likely change this to the location of closure on your system.
You will most likely change this to the location of closure on your system.
Defaults to ``'/usr/local/bin/uglifyjs'``.
Defaults to ``'/usr/local/bin/uglifyjs'``.
``PIPELINE_UGLIFYJS_ARGUMENTS``
``PIPELINE_UGLIFYJS_ARGUMENTS``
-------------------------------
-------------------------------
Additional arguments to use when uglifyjs is called.
Additional arguments to use when uglifyjs is called.
Default to ``''``
Default to ``''``
...
@@ -122,6 +122,21 @@ Install the jsmin library with your favorite Python package manager ::
...
@@ -122,6 +122,21 @@ Install the jsmin library with your favorite Python package manager ::
pip install jsmin
pip install jsmin
SlimIt compressor
=================
The slimit compressor uses `SlimIt <http://slimit.org/>`_ to
compress javascripts.
To use it add this to your ``PIPELINE_JS_COMPRESSOR`` ::
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.slimit.SlimItCompressor'
Install the slimit library with your favorite Python package manager ::
pip install slimit
CSSTidy compressor
CSSTidy compressor
==================
==================
...
@@ -137,7 +152,7 @@ To us it for your stylesheets add this to your ``PIPELINE_CSS_COMPRESSOR`` ::
...
@@ -137,7 +152,7 @@ To us it for your stylesheets add this to your ``PIPELINE_CSS_COMPRESSOR`` ::
Command line to execute for csstidy program.
Command line to execute for csstidy program.
You will most likely change this to the location of csstidy on your system.
You will most likely change this to the location of csstidy on your system.
Defaults to ``'/usr/local/bin/csstidy'``
Defaults to ``'/usr/local/bin/csstidy'``
``PIPELINE_CSSTIDY_ARGUMENTS``
``PIPELINE_CSSTIDY_ARGUMENTS``
...
@@ -169,7 +184,7 @@ of compressors.
...
@@ -169,7 +184,7 @@ of compressors.
To do so, you just have to create a class that inherits from ``pipeline.compressors.CompressorBase``
To do so, you just have to create a class that inherits from ``pipeline.compressors.CompressorBase``
and implements ``compress_css`` and/or a ``compress_js`` when needed.
and implements ``compress_css`` and/or a ``compress_js`` when needed.
Finally, add it to ``PIPELINE_CSS_COMPRESSOR`` or
Finally, add it to ``PIPELINE_CSS_COMPRESSOR`` or
``PIPELINE_JS_COMPRESSOR`` settings (see :doc:`configuration` for more information).
``PIPELINE_JS_COMPRESSOR`` settings (see :doc:`configuration` for more information).
Example
Example
...
@@ -178,14 +193,14 @@ Example
...
@@ -178,14 +193,14 @@ Example
A custom compressor for an imaginary compressor called jam ::
A custom compressor for an imaginary compressor called jam ::
from pipeline.compressors import CompressorBase
from pipeline.compressors import CompressorBase
class JamCompressor(CompressorBase):
class JamCompressor(CompressorBase):
def compress_js(self, js):
def compress_js(self, js):
return jam.compress(js)
return jam.compress(js)
def compress_css(self, css):
def compress_css(self, css):
return jam.compress(css)
return jam.compress(css)
Add it to your settings ::
Add it to your settings ::
...
...
pipeline/compressors/slimit.py
0 → 100644
View file @
7b105bed
from
__future__
import
absolute_import
from
pipeline.compressors
import
CompressorBase
class
SlimItCompressor
(
CompressorBase
):
"""
JS compressor based on the Python library slimit
(http://pypi.python.org/pypi/slimit/).
"""
def
compress_js
(
self
,
js
):
from
slimit
import
minify
return
minify
(
js
)
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