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
337d7224
Commit
337d7224
authored
Jul 16, 2012
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #128 from brantyoung/master
add support for slimit compressor
parents
2b8dc5cb
37fb925b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
14 deletions
+44
-14
AUTHORS
+2
-0
docs/compressors.rst
+29
-14
pipeline/compressors/slimit.py
+13
-0
No files found.
AUTHORS
View file @
337d7224
...
...
@@ -36,3 +36,5 @@ or just made Pipeline more awesome.
* Steven Cummings <estebistec@gmail.com>
* Timothée Peignier <timothee.peignier@tryphon.org>
* Trey Smith <trey.smith@nasa.gov>
* Brant Young <brant.young@gmail.com>
docs/compressors.rst
View file @
337d7224
...
...
@@ -9,7 +9,7 @@ YUI Compressor 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`` ::
...
...
@@ -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.
You will most likely change this to the location of yui-compressor on your system.
Defaults to ``'/usr/local/bin/yuicompressor'``.
.. warning::
Don't point to ``yuicompressor.jar`` directly, we expect to find a executable script.
``PIPELINE_YUI_CSS_ARGUMENTS``
------------------------------
...
...
@@ -43,7 +43,7 @@ To use it for your javascripts add this to your ``PIPELINE_JS_COMPRESSOR`` ::
-----------------------------
Additional arguments to use when compressing JavaScript.
Defaults to ``''``.
...
...
@@ -65,7 +65,7 @@ To use it add this to your ``PIPELINE_JS_COMPRESSOR`` ::
Command line to execute for the Closure Compiler program.
You will most likely change this to the location of closure on your system.
Default to ``'/usr/local/bin/closure'``
.. warning::
...
...
@@ -76,7 +76,7 @@ To use it add this to your ``PIPELINE_JS_COMPRESSOR`` ::
------------------------------
Additional arguments to use when closure is called.
Default to ``''``
...
...
@@ -96,14 +96,14 @@ To use it add this to your ``PIPELINE_JS_COMPRESSOR`` ::
Command line to execute for the Closure Compiler program.
You will most likely change this to the location of closure on your system.
Defaults to ``'/usr/local/bin/uglifyjs'``.
``PIPELINE_UGLIFYJS_ARGUMENTS``
-------------------------------
Additional arguments to use when uglifyjs is called.
Default to ``''``
...
...
@@ -122,6 +122,21 @@ Install the jsmin library with your favorite Python package manager ::
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
==================
...
...
@@ -137,7 +152,7 @@ To us it for your stylesheets add this to your ``PIPELINE_CSS_COMPRESSOR`` ::
Command line to execute for csstidy program.
You will most likely change this to the location of csstidy on your system.
Defaults to ``'/usr/local/bin/csstidy'``
``PIPELINE_CSSTIDY_ARGUMENTS``
...
...
@@ -169,7 +184,7 @@ of compressors.
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.
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).
Example
...
...
@@ -178,14 +193,14 @@ Example
A custom compressor for an imaginary compressor called jam ::
from pipeline.compressors import CompressorBase
class JamCompressor(CompressorBase):
def compress_js(self, js):
return jam.compress(js)
def compress_css(self, css):
return jam.compress(css)
Add it to your settings ::
...
...
pipeline/compressors/slimit.py
0 → 100644
View file @
337d7224
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