Commit f66cf24a by Timothée Peignier

Merge branch '1.6.x'

parents f570657a b8cec3ce
language: python language: python
sudo: false sudo: false
env: env:
- TOXENV=py27-1.7.X - TOXENV=py27-django18
- TOXENV=pypy-1.7.X - TOXENV=pypy-django18
- TOXENV=py33-1.7.X - TOXENV=py34-django18
- TOXENV=py34-1.7.X - TOXENV=py27-django19
- TOXENV=py27 - TOXENV=pypy-django19
- TOXENV=pypy - TOXENV=py34-django19
- TOXENV=py33
- TOXENV=py34
docsinstall: pip install -q tox docsinstall: pip install -q tox
script: tox script: tox
...@@ -11,13 +11,13 @@ Coffee Script compiler ...@@ -11,13 +11,13 @@ Coffee Script compiler
The Coffee Script compiler uses `Coffee Script <http://jashkenas.github.com/coffeescript/>`_ The Coffee Script compiler uses `Coffee Script <http://jashkenas.github.com/coffeescript/>`_
to compile your javascript. to compile your javascript.
To use it add this to your ``PIPELINE_COMPILERS`` :: To use it add this to your ``PIPELINE['COMPILERS']`` ::
PIPELINE_COMPILERS = ( PIPELINE['COMPILERS'] = (
'pipeline.compilers.coffee.CoffeeScriptCompiler', 'pipeline.compilers.coffee.CoffeeScriptCompiler',
) )
``PIPELINE_COFFEE_SCRIPT_BINARY`` ``COFFEE_SCRIPT_BINARY``
--------------------------------- ---------------------------------
Command line to execute for coffee program. Command line to execute for coffee program.
...@@ -25,7 +25,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` :: ...@@ -25,7 +25,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` ::
Defaults to ``'/usr/bin/env coffee'``. Defaults to ``'/usr/bin/env coffee'``.
``PIPELINE_COFFEE_SCRIPT_ARGUMENTS`` ``COFFEE_SCRIPT_ARGUMENTS``
------------------------------------ ------------------------------------
Additional arguments to use when coffee is called. Additional arguments to use when coffee is called.
...@@ -38,13 +38,13 @@ Live Script compiler ...@@ -38,13 +38,13 @@ Live Script compiler
The LiveScript compiler uses `LiveScript <https://github.com/gkz/LiveScript>`_ The LiveScript compiler uses `LiveScript <https://github.com/gkz/LiveScript>`_
to compile your javascript. to compile your javascript.
To use it add this to your ``PIPELINE_COMPILERS`` :: To use it add this to your ``PIPELINE['COMPILERS']`` ::
PIPELINE_COMPILERS = ( PIPELINE['COMPILERS'] = (
'pipeline.compilers.livescript.LiveScriptCompiler', 'pipeline.compilers.livescript.LiveScriptCompiler',
) )
``PIPELINE_LIVE_SCRIPT_BINARY`` ``LIVE_SCRIPT_BINARY``
--------------------------------- ---------------------------------
Command line to execute for LiveScript program. Command line to execute for LiveScript program.
...@@ -52,7 +52,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` :: ...@@ -52,7 +52,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` ::
Defaults to ``'/usr/bin/env lsc'``. Defaults to ``'/usr/bin/env lsc'``.
``PIPELINE_LIVE_SCRIPT_ARGUMENTS`` ``LIVE_SCRIPT_ARGUMENTS``
------------------------------------ ------------------------------------
Additional arguments to use when lsc is called. Additional arguments to use when lsc is called.
...@@ -65,13 +65,13 @@ LESS compiler ...@@ -65,13 +65,13 @@ LESS compiler
The LESS compiler uses `LESS <http://lesscss.org/>`_ The LESS compiler uses `LESS <http://lesscss.org/>`_
to compile your stylesheets. to compile your stylesheets.
To use it add this to your ``PIPELINE_COMPILERS`` :: To use it add this to your ``PIPELINE['COMPILERS']`` ::
PIPELINE_COMPILERS = ( PIPELINE['COMPILERS'] = (
'pipeline.compilers.less.LessCompiler', 'pipeline.compilers.less.LessCompiler',
) )
``PIPELINE_LESS_BINARY`` ``LESS_BINARY``
------------------------ ------------------------
Command line to execute for lessc program. Command line to execute for lessc program.
...@@ -79,7 +79,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` :: ...@@ -79,7 +79,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` ::
Defaults to ``'/usr/bin/env lessc'``. Defaults to ``'/usr/bin/env lessc'``.
``PIPELINE_LESS_ARGUMENTS`` ``LESS_ARGUMENTS``
--------------------------- ---------------------------
Additional arguments to use when lessc is called. Additional arguments to use when lessc is called.
...@@ -92,14 +92,14 @@ SASS compiler ...@@ -92,14 +92,14 @@ SASS compiler
The SASS compiler uses `SASS <http://sass-lang.com/>`_ The SASS compiler uses `SASS <http://sass-lang.com/>`_
to compile your stylesheets. to compile your stylesheets.
To use it add this to your ``PIPELINE_COMPILERS`` :: To use it add this to your ``PIPELINE['COMPILERS']`` ::
PIPELINE_COMPILERS = ( PIPELINE['COMPILERS'] = (
'pipeline.compilers.sass.SASSCompiler', 'pipeline.compilers.sass.SASSCompiler',
) )
``PIPELINE_SASS_BINARY`` ``SASS_BINARY``
------------------------ ------------------------
Command line to execute for sass program. Command line to execute for sass program.
...@@ -107,7 +107,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` :: ...@@ -107,7 +107,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` ::
Defaults to ``'/usr/bin/env sass'``. Defaults to ``'/usr/bin/env sass'``.
``PIPELINE_SASS_ARGUMENTS`` ``SASS_ARGUMENTS``
--------------------------- ---------------------------
Additional arguments to use when sass is called. Additional arguments to use when sass is called.
...@@ -121,14 +121,14 @@ Stylus compiler ...@@ -121,14 +121,14 @@ Stylus compiler
The Stylus compiler uses `Stylus <http://learnboost.github.com/stylus/>`_ The Stylus compiler uses `Stylus <http://learnboost.github.com/stylus/>`_
to compile your stylesheets. to compile your stylesheets.
To use it add this to your ``PIPELINE_COMPILERS`` :: To use it add this to your ``PIPELINE['COMPILERS']`` ::
PIPELINE_COMPILERS = ( PIPELINE['COMPILERS'] = (
'pipeline.compilers.stylus.StylusCompiler', 'pipeline.compilers.stylus.StylusCompiler',
) )
``PIPELINE_STYLUS_BINARY`` ``STYLUS_BINARY``
-------------------------- --------------------------
Command line to execute for stylus program. Command line to execute for stylus program.
...@@ -136,7 +136,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` :: ...@@ -136,7 +136,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` ::
Defaults to ``'/usr/bin/env stylus'``. Defaults to ``'/usr/bin/env stylus'``.
``PIPELINE_STYLUS_ARGUMENTS`` ``STYLUS_ARGUMENTS``
----------------------------- -----------------------------
Additional arguments to use when stylus is called. Additional arguments to use when stylus is called.
...@@ -150,14 +150,14 @@ ES6 compiler ...@@ -150,14 +150,14 @@ ES6 compiler
The ES6 compiler uses `Babel <https://babeljs.io>`_ The ES6 compiler uses `Babel <https://babeljs.io>`_
to convert ES6+ code into vanilla ES5. to convert ES6+ code into vanilla ES5.
To use it add this to your ``PIPELINE_COMPILERS`` :: To use it add this to your ``PIPELINE['COMPILERS']`` ::
PIPELINE_COMPILERS = ( PIPELINE['COMPILERS'] = (
'pipeline.compilers.es6.ES6Compiler', 'pipeline.compilers.es6.ES6Compiler',
) )
``PIPELINE_BABEL_BINARY`` ``BABEL_BINARY``
-------------------------- --------------------------
Command line to execute for babel program. Command line to execute for babel program.
...@@ -165,7 +165,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` :: ...@@ -165,7 +165,7 @@ To use it add this to your ``PIPELINE_COMPILERS`` ::
Defaults to ``'/usr/bin/env babel'``. Defaults to ``'/usr/bin/env babel'``.
``PIPELINE_BABEL_ARGUMENTS`` ``BABEL_ARGUMENTS``
----------------------------- -----------------------------
Additional arguments to use when babel is called. Additional arguments to use when babel is called.
...@@ -182,7 +182,7 @@ of compilers. ...@@ -182,7 +182,7 @@ of compilers.
To do so, you just have to create a class that inherits from ``pipeline.compilers.CompilerBase`` To do so, you just have to create a class that inherits from ``pipeline.compilers.CompilerBase``
and implements ``match_file`` and ``compile_file`` when needed. and implements ``match_file`` and ``compile_file`` when needed.
Finally, specify it in the tuple of compilers ``PIPELINE_COMPILERS`` in the settings. Finally, specify it in the tuple of compilers ``PIPELINE['COMPILERS']`` in the settings.
Example Example
------- -------
......
...@@ -11,13 +11,13 @@ Yuglify compressor ...@@ -11,13 +11,13 @@ Yuglify compressor
The Yuglify compressor uses `yuglify <http://github.com/yui/yuglify>`_ The Yuglify compressor uses `yuglify <http://github.com/yui/yuglify>`_
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']`` ::
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor' PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.yuglify.YuglifyCompressor'
To use it for your javascripts add this to your ``PIPELINE_JS_COMPRESSOR`` :: To use it for your javascripts add this to your ``PIPELINE['JS_COMPRESSOR']`` ::
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor' PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.yuglify.YuglifyCompressor'
``PIPELINE_YUGLIFY_BINARY`` ``PIPELINE_YUGLIFY_BINARY``
...@@ -49,13 +49,13 @@ YUI Compressor compressor ...@@ -49,13 +49,13 @@ 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']`` ::
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor' PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.yui.YUICompressor'
To use it for your javascripts add this to your ``PIPELINE_JS_COMPRESSOR`` :: To use it for your javascripts add this to your ``PIPELINE['JS_COMPRESSOR']`` ::
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yui.YUICompressor' PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.yui.YUICompressor'
``PIPELINE_YUI_BINARY`` ``PIPELINE_YUI_BINARY``
...@@ -91,9 +91,9 @@ Closure Compiler compressor ...@@ -91,9 +91,9 @@ Closure Compiler compressor
The Closure compressor uses `Google Closure Compiler <http://code.google.com/closure/compiler/>`_ The Closure compressor uses `Google Closure Compiler <http://code.google.com/closure/compiler/>`_
to compress javascripts. to compress javascripts.
To use it add this to your ``PIPELINE_JS_COMPRESSOR`` :: To use it add this to your ``PIPELINE['JS_COMPRESSOR']`` ::
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.closure.ClosureCompressor' PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.closure.ClosureCompressor'
``PIPELINE_CLOSURE_BINARY`` ``PIPELINE_CLOSURE_BINARY``
...@@ -122,9 +122,9 @@ UglifyJS compressor ...@@ -122,9 +122,9 @@ UglifyJS compressor
The UglifyJS compressor uses `UglifyJS <https://github.com/mishoo/UglifyJS2/>`_ to The UglifyJS compressor uses `UglifyJS <https://github.com/mishoo/UglifyJS2/>`_ to
compress javascripts. compress javascripts.
To use it add this to your ``PIPELINE_JS_COMPRESSOR`` :: To use it add this to your ``PIPELINE['JS_COMPRESSOR']`` ::
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.uglifyjs.UglifyJSCompressor' PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.uglifyjs.UglifyJSCompressor'
``PIPELINE_UGLIFYJS_BINARY`` ``PIPELINE_UGLIFYJS_BINARY``
...@@ -149,9 +149,9 @@ JSMin compressor ...@@ -149,9 +149,9 @@ JSMin compressor
The jsmin compressor uses Douglas Crockford jsmin tool to The jsmin compressor uses Douglas Crockford jsmin tool to
compress javascripts. compress javascripts.
To use it add this to your ``PIPELINE_JS_COMPRESSOR`` :: To use it add this to your ``PIPELINE['JS_COMPRESSOR']`` ::
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.jsmin.JSMinCompressor' PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.jsmin.JSMinCompressor'
Install the jsmin library with your favorite Python package manager :: Install the jsmin library with your favorite Python package manager ::
...@@ -164,9 +164,9 @@ SlimIt compressor ...@@ -164,9 +164,9 @@ SlimIt compressor
The slimit compressor uses `SlimIt <http://slimit.org/>`_ to The slimit compressor uses `SlimIt <http://slimit.org/>`_ to
compress javascripts. compress javascripts.
To use it add this to your ``PIPELINE_JS_COMPRESSOR`` :: To use it add this to your ``PIPELINE['JS_COMPRESSOR']`` ::
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.slimit.SlimItCompressor' PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.slimit.SlimItCompressor'
Install the slimit library with your favorite Python package manager :: Install the slimit library with your favorite Python package manager ::
...@@ -179,9 +179,9 @@ CSSTidy compressor ...@@ -179,9 +179,9 @@ CSSTidy compressor
The CSStidy compressor uses `CSStidy <http://csstidy.sourceforge.net/>`_ to compress The CSStidy compressor uses `CSStidy <http://csstidy.sourceforge.net/>`_ to compress
stylesheets. stylesheets.
To us it for your stylesheets add this to your ``PIPELINE_CSS_COMPRESSOR`` :: To us it for your stylesheets add this to your ``PIPELINE['CSS_COMPRESSOR']`` ::
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.csstidy.CSSTidyCompressor' PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.csstidy.CSSTidyCompressor'
``PIPELINE_CSSTIDY_BINARY`` ``PIPELINE_CSSTIDY_BINARY``
--------------------------- ---------------------------
...@@ -202,9 +202,9 @@ CSSMin compressor ...@@ -202,9 +202,9 @@ CSSMin compressor
================= =================
The cssmin compressor uses the `cssmin <https://github.com/jbleuzen/node-cssmin>`_ 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`` :: command to compress stylesheets. To use it, add this to your ``PIPELINE['CSS_COMPRESSOR']`` ::
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.cssmin.CSSMinCompressor' PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.cssmin.CSSMinCompressor'
``PIPELINE_CSSMIN_BINARY`` ``PIPELINE_CSSMIN_BINARY``
--------------------------- ---------------------------
...@@ -229,8 +229,8 @@ This is useful for debugging faulty concatenation due to poorly written javascri ...@@ -229,8 +229,8 @@ This is useful for debugging faulty concatenation due to poorly written javascri
To use it, add this to your settings :: To use it, add this to your settings ::
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.NoopCompressor' PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.NoopCompressor'
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.NoopCompressor' PIPELINE['JS_COMPRESSOR'] = 'pipeline.compressors.NoopCompressor'
Write your own compressor class Write your own compressor class
...@@ -242,8 +242,8 @@ of compressors. ...@@ -242,8 +242,8 @@ 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
------- -------
...@@ -262,5 +262,6 @@ A custom compressor for an imaginary compressor called jam :: ...@@ -262,5 +262,6 @@ A custom compressor for an imaginary compressor called jam ::
Add it to your settings :: Add it to your settings ::
PIPELINE_CSS_COMPRESSOR = 'jam.compressors.JamCompressor' PIPELINE['CSS_COMPRESSOR'] = 'jam.compressors.JamCompressor'
PIPELINE_JS_COMPRESSOR = 'jam.compressors.JamCompressor' PIPELINE['JS_COMPRESSOR'] = 'jam.compressors.JamCompressor'
...@@ -5,7 +5,22 @@ Configuration ...@@ -5,7 +5,22 @@ Configuration
============= =============
Configuration and list of available settings for Pipeline Configuration and list of available settings for Pipeline. Pipeline settings are namespaced in a PIPELINE dictionary in your project settings, e.g.: ::
PIPELINE = {
'PIPELINE_ENABLED': True,
'JAVASCRIPT': {
'stats': {
'source_filenames': (
'js/jquery.js',
'js/d3.js',
'js/collections/*.js',
'js/application.js',
),
'output_filename': 'js/stats.js',
}
}
}
Specifying files Specifying files
...@@ -16,29 +31,30 @@ syntax to select multiples files. ...@@ -16,29 +31,30 @@ syntax to select multiples files.
The basic syntax for specifying CSS/JavaScript groups files is :: The basic syntax for specifying CSS/JavaScript groups files is ::
PIPELINE_CSS = { PIPELINE = {
'colors': { 'STYLESHEETS': {
'source_filenames': ( 'colors': {
'css/core.css', 'source_filenames': (
'css/colors/*.css', 'css/core.css',
'css/layers.css' 'css/colors/*.css',
), 'css/layers.css'
'output_filename': 'css/colors.css', ),
'extra_context': { 'output_filename': 'css/colors.css',
'media': 'screen,projection', 'extra_context': {
'media': 'screen,projection',
},
}, },
}, },
} 'JAVASCRIPT': {
'stats': {
PIPELINE_JS = { 'source_filenames': (
'stats': { 'js/jquery.js',
'source_filenames': ( 'js/d3.js',
'js/jquery.js', 'js/collections/*.js',
'js/d3.js', 'js/application.js',
'js/collections/*.js', ),
'js/application.js', 'output_filename': 'js/stats.js',
), }
'output_filename': 'js/stats.js',
} }
} }
...@@ -118,7 +134,7 @@ Other settings ...@@ -118,7 +134,7 @@ Other settings
Defaults to ``not settings.DEBUG``. Defaults to ``not settings.DEBUG``.
``PIPELINE_CSS_COMPRESSOR`` ``CSS_COMPRESSOR``
............................ ............................
Compressor class to be applied to CSS files. Compressor class to be applied to CSS files.
...@@ -127,7 +143,7 @@ Other settings ...@@ -127,7 +143,7 @@ Other settings
Defaults to ``'pipeline.compressors.yuglify.YuglifyCompressor'``. Defaults to ``'pipeline.compressors.yuglify.YuglifyCompressor'``.
``PIPELINE_JS_COMPRESSOR`` JS_COMPRESSOR``
........................... ...........................
Compressor class to be applied to JavaScript files. Compressor class to be applied to JavaScript files.
...@@ -140,7 +156,7 @@ Other settings ...@@ -140,7 +156,7 @@ Other settings
Please note that in order to use Yuglify compressor, you need to install Yuglify (see :doc:`installation` for more details). Please note that in order to use Yuglify compressor, you need to install Yuglify (see :doc:`installation` for more details).
``PIPELINE_TEMPLATE_NAMESPACE`` TEMPLATE_NAMESPACE``
............................... ...............................
Object name where all of your compiled templates will be added, from within your browser. Object name where all of your compiled templates will be added, from within your browser.
...@@ -149,7 +165,7 @@ Other settings ...@@ -149,7 +165,7 @@ Other settings
Defaults to ``"window.JST"`` Defaults to ``"window.JST"``
``PIPELINE_TEMPLATE_EXT`` TEMPLATE_EXT``
......................... .........................
The extension for which Pipeline will consider the file as a Javascript template. The extension for which Pipeline will consider the file as a Javascript template.
...@@ -157,7 +173,7 @@ Other settings ...@@ -157,7 +173,7 @@ Other settings
Defaults to ``".jst"`` Defaults to ``".jst"``
``PIPELINE_TEMPLATE_FUNC`` TEMPLATE_FUNC``
.......................... ..........................
JavaScript function that compiles your JavaScript templates. JavaScript function that compiles your JavaScript templates.
...@@ -167,7 +183,7 @@ Other settings ...@@ -167,7 +183,7 @@ Other settings
Defaults to ``"_.template"`` Defaults to ``"_.template"``
``PIPELINE_TEMPLATE_SEPARATOR`` TEMPLATE_SEPARATOR``
............................... ...............................
Character chain used by Pipeline as replacement for directory separator. Character chain used by Pipeline as replacement for directory separator.
...@@ -175,7 +191,7 @@ Other settings ...@@ -175,7 +191,7 @@ Other settings
Defaults to ``"_"`` Defaults to ``"_"``
``PIPELINE_MIMETYPES`` MIMETYPES``
...................... ......................
Tuple that match file extension with their corresponding mimetypes. Tuple that match file extension with their corresponding mimetypes.
...@@ -203,7 +219,7 @@ modern browsers. ...@@ -203,7 +219,7 @@ modern browsers.
To do so, setup variant group options to the method you wish to use : :: To do so, setup variant group options to the method you wish to use : ::
PIPELINE_CSS = { 'STYLESHEETS' = {
'master': { 'master': {
'source_filenames': ( 'source_filenames': (
'css/core.css', 'css/core.css',
...@@ -225,7 +241,7 @@ Overriding embedding settings ...@@ -225,7 +241,7 @@ Overriding embedding settings
You can override these rules using the following settings: You can override these rules using the following settings:
``PIPELINE_EMBED_MAX_IMAGE_SIZE`` EMBED_MAX_IMAGE_SIZE``
................................. .................................
Setting that controls the maximum image size (in bytes) to embed in CSS using Data-URIs. Setting that controls the maximum image size (in bytes) to embed in CSS using Data-URIs.
...@@ -233,7 +249,7 @@ You can override these rules using the following settings: ...@@ -233,7 +249,7 @@ You can override these rules using the following settings:
Defaults to ``32700`` Defaults to ``32700``
``PIPELINE_EMBED_PATH`` EMBED_PATH``
....................... .......................
Setting the directory that an asset needs to be in so that it is embedded Setting the directory that an asset needs to be in so that it is embedded
...@@ -253,10 +269,10 @@ Wrapped javascript output ...@@ -253,10 +269,10 @@ Wrapped javascript output
All javascript output is wrapped in an anonymous function : :: All javascript output is wrapped in an anonymous function : ::
(function(){ (function(){
//JS output... //JS output...
})(); })();
This safety wrapper, make it difficult to pollute the global namespace by accident and improve performance. This safety wrapper, make it difficult to pollute the global namespace by accident and improve performance.
You can override this behavior by setting ``PIPELINE_DISABLE_WRAPPER`` to ``True``. You can override this behavior by setting DISABLE_WRAPPER`` to ``True``.
...@@ -35,7 +35,7 @@ Installation ...@@ -35,7 +35,7 @@ Installation
.. _PyPI: http://pypi.python.org/pypi/django-pipeline .. _PyPI: http://pypi.python.org/pypi/django-pipeline
Upgrading from 1.3 Upgrading from 1.3
================ ==================
To upgrade from pipeline 1.3, you will need to follow these steps: To upgrade from pipeline 1.3, you will need to follow these steps:
......
...@@ -111,7 +111,7 @@ Add your Bower directory to your ``STATICFILES_DIRS`` : :: ...@@ -111,7 +111,7 @@ Add your Bower directory to your ``STATICFILES_DIRS`` : ::
Then process the relevant content through Pipeline : :: Then process the relevant content through Pipeline : ::
PIPELINE_JS = { PIPELINE['JAVASCRIPT'] = {
'components': { 'components': {
'source_filenames': ( 'source_filenames': (
'jquery/jquery.js', 'jquery/jquery.js',
......
...@@ -5,9 +5,9 @@ Javascript Templates ...@@ -5,9 +5,9 @@ Javascript Templates
==================== ====================
Pipeline allows you to use javascript templates along with your javascript views. Pipeline allows you to use javascript templates along with your javascript views.
To use your javascript templates, just add them to your ``PIPELINE_JS`` group :: To use your javascript templates, just add them to your ``JAVASCRIPT`` group ::
PIPELINE_JS = { PIPELINE['JAVASCRIPT'] = {
'application': { 'application': {
'source_filenames': ( 'source_filenames': (
'js/application.js', 'js/application.js',
...@@ -37,34 +37,34 @@ Configuration ...@@ -37,34 +37,34 @@ Configuration
Template function Template function
................. .................
By default, Pipeline uses a variant of `Micro Templating <http://ejohn.org/blog/javascript-micro-templating/>`_ to compile the templates, but you can choose your preferred JavaScript templating engine by changing ``PIPELINE_TEMPLATE_FUNC`` :: By default, Pipeline uses a variant of `Micro Templating <http://ejohn.org/blog/javascript-micro-templating/>`_ to compile the templates, but you can choose your preferred JavaScript templating engine by changing ``PIPELINE['TEMPLATE_FUNC']`` ::
PIPELINE_TEMPLATE_FUNC = 'template' PIPELINE['TEMPLATE_FUNC'] = 'template'
Template namespace Template namespace
.................. ..................
Your templates are made available in a top-level object, by default ``window.JST``, Your templates are made available in a top-level object, by default ``window.JST``,
but you can choose your own via ``PIPELINE_TEMPLATE_NAMESPACE`` :: but you can choose your own via ``PIPELINE['TEMPLATE_NAMESPACE']`` ::
PIPELINE_TEMPLATE_NAMESPACE = 'window.Template' PIPELINE['TEMPLATE_NAMESPACE'] = 'window.Template'
Template extension Template extension
.................. ..................
Templates are detected by their extension, by default ``.jst``, but you can use Templates are detected by their extension, by default ``.jst``, but you can use
your own extension via ``PIPELINE_TEMPLATE_EXT`` :: your own extension via ``PIPELINE['TEMPLATE_EXT']`` ::
PIPELINE_TEMPLATE_EXT = '.mustache' PIPELINE['TEMPLATE_EXT'] = '.mustache'
Template separator Template separator
.................. ..................
Templates identifier are built using a replacement for directory separator, Templates identifier are built using a replacement for directory separator,
by default ``_``, but you specify your own sperator via ``PIPELINE_TEMPLATE_SEPARATOR`` :: by default ``_``, but you specify your own separator via ``PIPELINE['TEMPLATE_SEPARATOR']`` ::
PIPELINE_TEMPLATE_SEPARATOR = '/' PIPELINE['TEMPLATE_SEPARATOR'] = '/'
Using it with your favorite template library Using it with your favorite template library
...@@ -88,33 +88,33 @@ some extra javascript :: ...@@ -88,33 +88,33 @@ some extra javascript ::
And use these settings :: And use these settings ::
PIPELINE_TEMPLATE_EXT = '.mustache' PIPELINE['TEMPLATE_EXT'] = '.mustache'
PIPELINE_TEMPLATE_FUNC = 'Mustache.template' PIPELINE['TEMPLATE_FUNC'] = 'Mustache.template'
Handlebars Handlebars
.......... ..........
To use it with `Handlebars <http://handlebarsjs.com/>`_, use the following settings :: To use it with `Handlebars <http://handlebarsjs.com/>`_, use the following settings ::
PIPELINE_TEMPLATE_EXT = '.handlebars' PIPELINE['TEMPLATE_EXT'] = '.handlebars'
PIPELINE_TEMPLATE_FUNC = 'Handlebars.compile' PIPELINE['TEMPLATE_FUNC'] = 'Handlebars.compile'
PIPELINE_TEMPLATE_NAMESPACE = 'Handlebars.templates' PIPELINE['TEMPLATE_NAMESPACE'] = 'Handlebars.templates'
Ember.js + Handlebars Ember.js + Handlebars
..................... .....................
To use it with `Ember.js <http://emberjs.com/>`_, use the following settings :: To use it with `Ember.js <http://emberjs.com/>`_, use the following settings ::
PIPELINE_TEMPLATE_EXT = '.handlebars' PIPELINE['TEMPLATE_EXT'] = '.handlebars'
PIPELINE_TEMPLATE_FUNC = 'Ember.Handlebars.compile' PIPELINE['TEMPLATE_FUNC'] = 'Ember.Handlebars.compile'
PIPELINE_TEMPLATE_NAMESPACE = 'window.Ember.TEMPLATES' PIPELINE['TEMPLATE_NAMESPACE'] = 'window.Ember.TEMPLATES'
PIPELINE_TEMPLATE_SEPARATOR = '/' PIPELINE['TEMPLATE_SEPARATOR'] = '/'
Prototype Prototype
......... .........
To use it with `Prototype <http://www.prototypejs.org/>`_, just setup your To use it with `Prototype <http://www.prototypejs.org/>`_, just setup your
``PIPELINE_TEMPLATE_FUNC`` :: ``PIPELINE['TEMPLATE_FUNC']`` ::
PIPELINE_TEMPLATE_FUNC = 'new Template' PIPELINE['TEMPLATE_FUNC'] = 'new Template'
...@@ -20,7 +20,7 @@ When ``settings.DEBUG`` is set to ``True`` the use of these template tags will ...@@ -20,7 +20,7 @@ When ``settings.DEBUG`` is set to ``True`` the use of these template tags will
result in a separate tag for each resource in a given group (i.e., the result in a separate tag for each resource in a given group (i.e., the
combined, compressed files will not be used), in order to make local debugging combined, compressed files will not be used), in order to make local debugging
easy. When ``settings.DEBUG`` is set to ``False`` the opposite is true. You can easy. When ``settings.DEBUG`` is set to ``False`` the opposite is true. You can
override the default behavior by setting ``settings.PIPELINE_ENABLED`` override the default behavior by setting ``settings.PIPELINE['PIPELINE_ENABLED']``
manually. When set to ``True`` or ``False`` this enables or disables, manually. When set to ``True`` or ``False`` this enables or disables,
respectively, the usage of the combined, compressed file for each resource respectively, the usage of the combined, compressed file for each resource
group. This can be useful, if you encounter errors in your compressed code that group. This can be useful, if you encounter errors in your compressed code that
......
...@@ -26,7 +26,7 @@ class Compiler(object): ...@@ -26,7 +26,7 @@ class Compiler(object):
@property @property
def compilers(self): def compilers(self):
return [to_class(compiler) for compiler in settings.PIPELINE_COMPILERS] return [to_class(compiler) for compiler in settings.COMPILERS]
def compile(self, paths, force=False): def compile(self, paths, force=False):
def _compile(input_path): def _compile(input_path):
......
...@@ -14,8 +14,8 @@ class CoffeeScriptCompiler(SubProcessCompiler): ...@@ -14,8 +14,8 @@ class CoffeeScriptCompiler(SubProcessCompiler):
if not outdated and not force: if not outdated and not force:
return # File doesn't need to be recompiled return # File doesn't need to be recompiled
command = "%s -cp %s %s > %s" % ( command = "%s -cp %s %s > %s" % (
settings.PIPELINE_COFFEE_SCRIPT_BINARY, settings.COFFEE_SCRIPT_BINARY,
settings.PIPELINE_COFFEE_SCRIPT_ARGUMENTS, settings.COFFEE_SCRIPT_ARGUMENTS,
infile, infile,
outfile outfile
) )
......
...@@ -14,8 +14,8 @@ class ES6Compiler(SubProcessCompiler): ...@@ -14,8 +14,8 @@ class ES6Compiler(SubProcessCompiler):
if not outdated and not force: if not outdated and not force:
return # File doesn't need to be recompiled return # File doesn't need to be recompiled
command = "%s %s %s -o %s" % ( command = "%s %s %s -o %s" % (
settings.PIPELINE_BABEL_BINARY, settings.BABEL_BINARY,
settings.PIPELINE_BABEL_ARGUMENTS, settings.BABEL_ARGUMENTS,
infile, infile,
outfile outfile
) )
......
...@@ -15,8 +15,8 @@ class LessCompiler(SubProcessCompiler): ...@@ -15,8 +15,8 @@ class LessCompiler(SubProcessCompiler):
def compile_file(self, infile, outfile, outdated=False, force=False): def compile_file(self, infile, outfile, outdated=False, force=False):
# Pipe to file rather than provide outfile arg due to a bug in lessc # Pipe to file rather than provide outfile arg due to a bug in lessc
command = "%s %s %s > %s" % ( command = "%s %s %s > %s" % (
settings.PIPELINE_LESS_BINARY, settings.LESS_BINARY,
settings.PIPELINE_LESS_ARGUMENTS, settings.LESS_ARGUMENTS,
infile, infile,
outfile outfile
) )
......
...@@ -14,8 +14,8 @@ class LiveScriptCompiler(SubProcessCompiler): ...@@ -14,8 +14,8 @@ class LiveScriptCompiler(SubProcessCompiler):
if not outdated and not force: if not outdated and not force:
return # File doesn't need to be recompiled return # File doesn't need to be recompiled
command = "%s -cp %s %s > %s" % ( command = "%s -cp %s %s > %s" % (
settings.PIPELINE_LIVE_SCRIPT_BINARY, settings.LIVE_SCRIPT_BINARY,
settings.PIPELINE_LIVE_SCRIPT_ARGUMENTS, settings.LIVE_SCRIPT_ARGUMENTS,
infile, infile,
outfile outfile
) )
......
...@@ -14,8 +14,8 @@ class SASSCompiler(SubProcessCompiler): ...@@ -14,8 +14,8 @@ class SASSCompiler(SubProcessCompiler):
def compile_file(self, infile, outfile, outdated=False, force=False): def compile_file(self, infile, outfile, outdated=False, force=False):
command = "%s %s %s %s" % ( command = "%s %s %s %s" % (
settings.PIPELINE_SASS_BINARY, settings.SASS_BINARY,
settings.PIPELINE_SASS_ARGUMENTS, settings.SASS_ARGUMENTS,
infile, infile,
outfile outfile
) )
......
...@@ -14,8 +14,8 @@ class StylusCompiler(SubProcessCompiler): ...@@ -14,8 +14,8 @@ class StylusCompiler(SubProcessCompiler):
def compile_file(self, infile, outfile, outdated=False, force=False): def compile_file(self, infile, outfile, outdated=False, force=False):
command = "%s %s %s" % ( command = "%s %s %s" % (
settings.PIPELINE_STYLUS_BINARY, settings.STYLUS_BINARY,
settings.PIPELINE_STYLUS_ARGUMENTS, settings.STYLUS_ARGUMENTS,
infile infile
) )
return self.execute_command(command, cwd=dirname(infile)) return self.execute_command(command, cwd=dirname(infile))
...@@ -47,11 +47,11 @@ class Compressor(object): ...@@ -47,11 +47,11 @@ class Compressor(object):
@property @property
def js_compressor(self): def js_compressor(self):
return to_class(settings.PIPELINE_JS_COMPRESSOR) return to_class(settings.JS_COMPRESSOR)
@property @property
def css_compressor(self): def css_compressor(self):
return to_class(settings.PIPELINE_CSS_COMPRESSOR) return to_class(settings.CSS_COMPRESSOR)
def compress_js(self, paths, templates=None, **kwargs): def compress_js(self, paths, templates=None, **kwargs):
"""Concatenate and compress JS files""" """Concatenate and compress JS files"""
...@@ -59,7 +59,7 @@ class Compressor(object): ...@@ -59,7 +59,7 @@ class Compressor(object):
if templates: if templates:
js = js + self.compile_templates(templates) js = js + self.compile_templates(templates)
if not settings.PIPELINE_DISABLE_WRAPPER: if not settings.DISABLE_WRAPPER:
js = "(function() {\n%s\n}).call(this);" % js js = "(function() {\n%s\n}).call(this);" % js
compressor = self.js_compressor compressor = self.js_compressor
...@@ -85,7 +85,7 @@ class Compressor(object): ...@@ -85,7 +85,7 @@ class Compressor(object):
compiled = [] compiled = []
if not paths: if not paths:
return '' return ''
namespace = settings.PIPELINE_TEMPLATE_NAMESPACE namespace = settings.TEMPLATE_NAMESPACE
base_path = self.base_path(paths) base_path = self.base_path(paths)
for path in paths: for path in paths:
contents = self.read_text(path) contents = self.read_text(path)
...@@ -95,10 +95,10 @@ class Compressor(object): ...@@ -95,10 +95,10 @@ class Compressor(object):
compiled.append("%s['%s'] = %s('%s');\n" % ( compiled.append("%s['%s'] = %s('%s');\n" % (
namespace, namespace,
name, name,
settings.PIPELINE_TEMPLATE_FUNC, settings.TEMPLATE_FUNC,
contents contents
)) ))
compiler = TEMPLATE_FUNC if settings.PIPELINE_TEMPLATE_FUNC == DEFAULT_TEMPLATE_FUNC else "" compiler = TEMPLATE_FUNC if settings.TEMPLATE_FUNC == DEFAULT_TEMPLATE_FUNC else ""
return "\n".join([ return "\n".join([
"%(namespace)s = %(namespace)s || {};" % {'namespace': namespace}, "%(namespace)s = %(namespace)s || {};" % {'namespace': namespace},
compiler, compiler,
...@@ -118,9 +118,9 @@ class Compressor(object): ...@@ -118,9 +118,9 @@ class Compressor(object):
if path == base: if path == base:
base = os.path.dirname(path) base = os.path.dirname(path)
name = re.sub(r"^%s[\/\\]?(.*)%s$" % ( name = re.sub(r"^%s[\/\\]?(.*)%s$" % (
re.escape(base), re.escape(settings.PIPELINE_TEMPLATE_EXT) re.escape(base), re.escape(settings.TEMPLATE_EXT)
), r"\1", path) ), r"\1", path)
return re.sub(r"[\/\\]", settings.PIPELINE_TEMPLATE_SEPARATOR, name) return re.sub(r"[\/\\]", settings.TEMPLATE_SEPARATOR, name)
def concatenate_and_rewrite(self, paths, output_filename, variant=None): def concatenate_and_rewrite(self, paths, output_filename, variant=None):
"""Concatenate together files and rewrite urls""" """Concatenate together files and rewrite urls"""
...@@ -163,11 +163,11 @@ class Compressor(object): ...@@ -163,11 +163,11 @@ class Compressor(object):
font = ext in FONT_EXTS font = ext in FONT_EXTS
if not variant: if not variant:
return False return False
if not (re.search(settings.PIPELINE_EMBED_PATH, path.replace('\\', '/')) and self.storage.exists(path)): if not (re.search(settings.EMBED_PATH, path.replace('\\', '/')) and self.storage.exists(path)):
return False return False
if ext not in EMBED_EXTS: if ext not in EMBED_EXTS:
return False return False
if not (font or len(self.encoded_content(path)) < settings.PIPELINE_EMBED_MAX_IMAGE_SIZE): if not (font or len(self.encoded_content(path)) < settings.EMBED_MAX_IMAGE_SIZE):
return False return False
return True return True
......
...@@ -6,5 +6,5 @@ from pipeline.compressors import SubProcessCompressor ...@@ -6,5 +6,5 @@ from pipeline.compressors import SubProcessCompressor
class ClosureCompressor(SubProcessCompressor): class ClosureCompressor(SubProcessCompressor):
def compress_js(self, js): def compress_js(self, js):
command = '%s %s' % (settings.PIPELINE_CLOSURE_BINARY, settings.PIPELINE_CLOSURE_ARGUMENTS) command = '%s %s' % (settings.CLOSURE_BINARY, settings.CLOSURE_ARGUMENTS)
return self.execute_command(command, js) return self.execute_command(command, js)
...@@ -6,5 +6,5 @@ from pipeline.compressors import SubProcessCompressor ...@@ -6,5 +6,5 @@ from pipeline.compressors import SubProcessCompressor
class CSSMinCompressor(SubProcessCompressor): class CSSMinCompressor(SubProcessCompressor):
def compress_css(self, css): def compress_css(self, css):
command = "%s %s" % (settings.PIPELINE_CSSMIN_BINARY, settings.PIPELINE_CSSMIN_ARGUMENTS) command = "%s %s" % (settings.CSSMIN_BINARY, settings.CSSMIN_ARGUMENTS)
return self.execute_command(command, css) return self.execute_command(command, css)
...@@ -11,8 +11,8 @@ class CSSTidyCompressor(SubProcessCompressor): ...@@ -11,8 +11,8 @@ class CSSTidyCompressor(SubProcessCompressor):
output_file = tempfile.NamedTemporaryFile(suffix='.pipeline') output_file = tempfile.NamedTemporaryFile(suffix='.pipeline')
command = '%s - %s %s' % ( command = '%s - %s %s' % (
settings.PIPELINE_CSSTIDY_BINARY, settings.CSSTIDY_BINARY,
settings.PIPELINE_CSSTIDY_ARGUMENTS, settings.CSSTIDY_ARGUMENTS,
output_file.name output_file.name
) )
self.execute_command(command, css) self.execute_command(command, css)
......
...@@ -6,7 +6,7 @@ from pipeline.compressors import SubProcessCompressor ...@@ -6,7 +6,7 @@ from pipeline.compressors import SubProcessCompressor
class UglifyJSCompressor(SubProcessCompressor): class UglifyJSCompressor(SubProcessCompressor):
def compress_js(self, js): def compress_js(self, js):
command = '%s %s' % (settings.PIPELINE_UGLIFYJS_BINARY, settings.PIPELINE_UGLIFYJS_ARGUMENTS) command = '%s %s' % (settings.UGLIFYJS_BINARY, settings.UGLIFYJS_ARGUMENTS)
if self.verbose: if self.verbose:
command += ' --verbose' command += ' --verbose'
return self.execute_command(command, js) return self.execute_command(command, js)
...@@ -6,11 +6,11 @@ from pipeline.compressors import SubProcessCompressor ...@@ -6,11 +6,11 @@ from pipeline.compressors import SubProcessCompressor
class YuglifyCompressor(SubProcessCompressor): class YuglifyCompressor(SubProcessCompressor):
def compress_common(self, content, compress_type, arguments): def compress_common(self, content, compress_type, arguments):
command = '%s --type=%s %s' % (settings.PIPELINE_YUGLIFY_BINARY, compress_type, arguments) command = '%s --type=%s %s' % (settings.YUGLIFY_BINARY, compress_type, arguments)
return self.execute_command(command, content) return self.execute_command(command, content)
def compress_js(self, js): def compress_js(self, js):
return self.compress_common(js, 'js', settings.PIPELINE_YUGLIFY_JS_ARGUMENTS) return self.compress_common(js, 'js', settings.YUGLIFY_JS_ARGUMENTS)
def compress_css(self, css): def compress_css(self, css):
return self.compress_common(css, 'css', settings.PIPELINE_YUGLIFY_CSS_ARGUMENTS) return self.compress_common(css, 'css', settings.YUGLIFY_CSS_ARGUMENTS)
...@@ -6,11 +6,11 @@ from pipeline.compressors import SubProcessCompressor ...@@ -6,11 +6,11 @@ from pipeline.compressors import SubProcessCompressor
class YUICompressor(SubProcessCompressor): class YUICompressor(SubProcessCompressor):
def compress_common(self, content, compress_type, arguments): def compress_common(self, content, compress_type, arguments):
command = '%s --type=%s %s' % (settings.PIPELINE_YUI_BINARY, compress_type, arguments) command = '%s --type=%s %s' % (settings.YUI_BINARY, compress_type, arguments)
return self.execute_command(command, content) return self.execute_command(command, content)
def compress_js(self, js): def compress_js(self, js):
return self.compress_common(js, 'js', settings.PIPELINE_YUI_JS_ARGUMENTS) return self.compress_common(js, 'js', settings.YUI_JS_ARGUMENTS)
def compress_css(self, css): def compress_css(self, css):
return self.compress_common(css, 'css', settings.PIPELINE_YUI_CSS_ARGUMENTS) return self.compress_common(css, 'css', settings.YUI_CSS_ARGUMENTS)
...@@ -4,66 +4,66 @@ from __future__ import unicode_literals ...@@ -4,66 +4,66 @@ from __future__ import unicode_literals
from django.conf import settings as _settings from django.conf import settings as _settings
DEFAULTS = { DEFAULTS = {
'DEBUG': False,
'PIPELINE_ENABLED': not _settings.DEBUG, 'PIPELINE_ENABLED': not _settings.DEBUG,
'PIPELINE_ROOT': _settings.STATIC_ROOT, 'PIPELINE_ROOT': _settings.STATIC_ROOT,
'PIPELINE_URL': _settings.STATIC_URL, 'PIPELINE_URL': _settings.STATIC_URL,
'PIPELINE_CSS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor', 'CSS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
'PIPELINE_JS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor', 'JS_COMPRESSOR': 'pipeline.compressors.yuglify.YuglifyCompressor',
'PIPELINE_COMPILERS': [], 'COMPILERS': [],
'STYLESHEETS': {},
'JAVASCRIPT': {},
'PIPELINE_CSS': {}, 'TEMPLATE_NAMESPACE': "window.JST",
'PIPELINE_JS': {}, 'TEMPLATE_EXT': ".jst",
'TEMPLATE_FUNC': "template",
'TEMPLATE_SEPARATOR': "_",
'PIPELINE_TEMPLATE_NAMESPACE': "window.JST", 'DISABLE_WRAPPER': False,
'PIPELINE_TEMPLATE_EXT': ".jst",
'PIPELINE_TEMPLATE_FUNC': "template",
'PIPELINE_TEMPLATE_SEPARATOR': "_",
'PIPELINE_DISABLE_WRAPPER': False, 'CSSTIDY_BINARY': '/usr/bin/env csstidy',
'CSSTIDY_ARGUMENTS': '--template=highest',
'PIPELINE_CSSTIDY_BINARY': '/usr/bin/env csstidy', 'YUGLIFY_BINARY': '/usr/bin/env yuglify',
'PIPELINE_CSSTIDY_ARGUMENTS': '--template=highest', 'YUGLIFY_CSS_ARGUMENTS': '--terminal',
'YUGLIFY_JS_ARGUMENTS': '--terminal',
'PIPELINE_YUGLIFY_BINARY': '/usr/bin/env yuglify', 'YUI_BINARY': '/usr/bin/env yuicompressor',
'PIPELINE_YUGLIFY_CSS_ARGUMENTS': '--terminal', 'YUI_CSS_ARGUMENTS': '',
'PIPELINE_YUGLIFY_JS_ARGUMENTS': '--terminal', 'YUI_JS_ARGUMENTS': '',
'PIPELINE_YUI_BINARY': '/usr/bin/env yuicompressor', 'CLOSURE_BINARY': '/usr/bin/env closure',
'PIPELINE_YUI_CSS_ARGUMENTS': '', 'CLOSURE_ARGUMENTS': '',
'PIPELINE_YUI_JS_ARGUMENTS': '',
'PIPELINE_CLOSURE_BINARY': '/usr/bin/env closure', 'UGLIFYJS_BINARY': '/usr/bin/env uglifyjs',
'PIPELINE_CLOSURE_ARGUMENTS': '', 'UGLIFYJS_ARGUMENTS': '',
'PIPELINE_UGLIFYJS_BINARY': '/usr/bin/env uglifyjs', 'CSSMIN_BINARY': '/usr/bin/env cssmin',
'PIPELINE_UGLIFYJS_ARGUMENTS': '', 'CSSMIN_ARGUMENTS': '',
'PIPELINE_CSSMIN_BINARY': '/usr/bin/env cssmin', 'COFFEE_SCRIPT_BINARY': '/usr/bin/env coffee',
'PIPELINE_CSSMIN_ARGUMENTS': '', 'COFFEE_SCRIPT_ARGUMENTS': '',
'PIPELINE_COFFEE_SCRIPT_BINARY': '/usr/bin/env coffee', 'BABEL_BINARY': '/usr/bin/env babel',
'PIPELINE_COFFEE_SCRIPT_ARGUMENTS': '', 'BABEL_ARGUMENTS': '',
'PIPELINE_BABEL_BINARY': '/usr/bin/env babel', 'LIVE_SCRIPT_BINARY': '/usr/bin/env lsc',
'PIPELINE_BABEL_ARGUMENTS': '', 'LIVE_SCRIPT_ARGUMENTS': '',
'PIPELINE_LIVE_SCRIPT_BINARY': '/usr/bin/env lsc', 'SASS_BINARY': '/usr/bin/env sass',
'PIPELINE_LIVE_SCRIPT_ARGUMENTS': '', 'SASS_ARGUMENTS': '',
'PIPELINE_SASS_BINARY': '/usr/bin/env sass', 'STYLUS_BINARY': '/usr/bin/env stylus',
'PIPELINE_SASS_ARGUMENTS': '', 'STYLUS_ARGUMENTS': '',
'PIPELINE_STYLUS_BINARY': '/usr/bin/env stylus', 'LESS_BINARY': '/usr/bin/env lessc',
'PIPELINE_STYLUS_ARGUMENTS': '', 'LESS_ARGUMENTS': '',
'PIPELINE_LESS_BINARY': '/usr/bin/env lessc', 'DISABLE_WRAPPER': False,
'PIPELINE_LESS_ARGUMENTS': '',
'PIPELINE_MIMETYPES': ( 'MIMETYPES': (
(b'text/coffeescript', '.coffee'), (b'text/coffeescript', '.coffee'),
(b'text/less', '.less'), (b'text/less', '.less'),
(b'text/javascript', '.js'), (b'text/javascript', '.js'),
...@@ -71,24 +71,18 @@ DEFAULTS = { ...@@ -71,24 +71,18 @@ DEFAULTS = {
(b'text/x-scss', '.scss') (b'text/x-scss', '.scss')
), ),
'PIPELINE_EMBED_MAX_IMAGE_SIZE': 32700, 'EMBED_MAX_IMAGE_SIZE': 32700,
'PIPELINE_EMBED_PATH': r'[/]?embed/', 'EMBED_PATH': r'[/]?embed/',
} }
class PipelineSettings(object): class PipelineSettings(object):
''' '''
Lazy Django settings wrapper for Django Pipeline Container object for pipeline settings
''' '''
def __init__(self, wrapped_settings): def __init__(self, wrapped_settings):
self.wrapped_settings = wrapped_settings DEFAULTS.update(wrapped_settings)
self.__dict__ = DEFAULTS
def __getattr__(self, name):
if hasattr(self.wrapped_settings, name):
return getattr(self.wrapped_settings, name)
elif name in DEFAULTS:
return DEFAULTS[name]
else:
raise AttributeError("'%s' setting not found" % name)
settings = PipelineSettings(_settings) settings = PipelineSettings(_settings.PIPELINE)
...@@ -24,10 +24,10 @@ class PipelineFinder(BaseStorageFinder): ...@@ -24,10 +24,10 @@ class PipelineFinder(BaseStorageFinder):
class ManifestFinder(BaseFinder): class ManifestFinder(BaseFinder):
def find(self, path, all=False): def find(self, path, all=False):
""" """
Looks for files in PIPELINE_CSS and PIPELINE_JS Looks for files in PIPELINE.STYLESHEETS and PIPELINE.JAVASCRIPT
""" """
matches = [] matches = []
for elem in chain(settings.PIPELINE_CSS.values(), settings.PIPELINE_JS.values()): for elem in chain(settings.STYLESHEETS.values(), settings.JAVASCRIPT.values()):
if elem['output_filename'] == path: if elem['output_filename'] == path:
match = safe_join(settings.PIPELINE_ROOT, path) match = safe_join(settings.PIPELINE_ROOT, path)
if not all: if not all:
......
...@@ -2,6 +2,7 @@ from __future__ import unicode_literals ...@@ -2,6 +2,7 @@ from __future__ import unicode_literals
import os import os
from django.conf.settings import settings as django_settings
from django.contrib.staticfiles.finders import get_finders from django.contrib.staticfiles.finders import get_finders
from django.contrib.staticfiles.storage import staticfiles_storage from django.contrib.staticfiles.storage import staticfiles_storage
...@@ -32,7 +33,6 @@ class PipelineManifest(Manifest): ...@@ -32,7 +33,6 @@ class PipelineManifest(Manifest):
return packages return packages
def cache(self): def cache(self):
ignore_patterns = getattr(settings, "STATICFILES_IGNORE_PATTERNS", None)
if settings.PIPELINE_ENABLED: if settings.PIPELINE_ENABLED:
for package in self.packages: for package in self.packages:
...@@ -45,6 +45,7 @@ class PipelineManifest(Manifest): ...@@ -45,6 +45,7 @@ class PipelineManifest(Manifest):
self.package_files.append(path) self.package_files.append(path)
yield staticfiles_storage.url(path) yield staticfiles_storage.url(path)
ignore_patterns = getattr(django_settings, "STATICFILES_IGNORE_PATTERNS", None)
for finder in self.finders: for finder in self.finders:
for path, storage in finder.list(ignore_patterns): for path, storage in finder.list(ignore_patterns):
# Prefix the relative path if the source storage contains it # Prefix the relative path if the source storage contains it
...@@ -55,5 +56,6 @@ class PipelineManifest(Manifest): ...@@ -55,5 +56,6 @@ class PipelineManifest(Manifest):
# Dont add any doubles # Dont add any doubles
if prefixed_path not in self.package_files: if prefixed_path not in self.package_files:
self.package_files.append(prefixed_path) self.package_files.append(prefixed_path)
yield staticfiles_storage.url(prefixed_path) yield staticfiles_storage.url(prefixed_path)
...@@ -32,12 +32,12 @@ class Package(object): ...@@ -32,12 +32,12 @@ class Package(object):
@property @property
def paths(self): def paths(self):
return [path for path in self.sources return [path for path in self.sources
if not path.endswith(settings.PIPELINE_TEMPLATE_EXT)] if not path.endswith(settings.TEMPLATE_EXT)]
@property @property
def templates(self): def templates(self):
return [path for path in self.sources return [path for path in self.sources
if path.endswith(settings.PIPELINE_TEMPLATE_EXT)] if path.endswith(settings.TEMPLATE_EXT)]
@property @property
def output_filename(self): def output_filename(self):
...@@ -69,9 +69,9 @@ class Packager(object): ...@@ -69,9 +69,9 @@ class Packager(object):
self.compressor = Compressor(storage=storage, verbose=verbose) self.compressor = Compressor(storage=storage, verbose=verbose)
self.compiler = Compiler(storage=storage, verbose=verbose) self.compiler = Compiler(storage=storage, verbose=verbose)
if css_packages is None: if css_packages is None:
css_packages = settings.PIPELINE_CSS css_packages = settings.STYLESHEETS
if js_packages is None: if js_packages is None:
js_packages = settings.PIPELINE_JS js_packages = settings.JAVASCRIPT
self.packages = { self.packages = {
'css': self.create_packages(css_packages), 'css': self.create_packages(css_packages),
'js': self.create_packages(js_packages), 'js': self.create_packages(js_packages),
......
...@@ -31,8 +31,8 @@ class PipelineMixin(object): ...@@ -31,8 +31,8 @@ class PipelineMixin(object):
def package_for(self, package_name, package_type): def package_for(self, package_name, package_type):
package = { package = {
'js': getattr(settings, 'PIPELINE_JS', {}).get(package_name, {}), 'js': getattr(settings, 'JAVASCRIPT', {}).get(package_name, {}),
'css': getattr(settings, 'PIPELINE_CSS', {}).get(package_name, {}), 'css': getattr(settings, 'STYLESHEETS', {}).get(package_name, {}),
}[package_type] }[package_type]
if package: if package:
...@@ -137,7 +137,7 @@ def stylesheet(parser, token): ...@@ -137,7 +137,7 @@ def stylesheet(parser, token):
try: try:
tag_name, name = token.split_contents() tag_name, name = token.split_contents()
except ValueError: except ValueError:
raise template.TemplateSyntaxError('%r requires exactly one argument: the name of a group in the PIPELINE_CSS setting' % token.split_contents()[0]) raise template.TemplateSyntaxError('%r requires exactly one argument: the name of a group in the PIPELINE.STYLESHEETS setting' % token.split_contents()[0])
return StylesheetNode(name) return StylesheetNode(name)
...@@ -146,5 +146,5 @@ def javascript(parser, token): ...@@ -146,5 +146,5 @@ def javascript(parser, token):
try: try:
tag_name, name = token.split_contents() tag_name, name = token.split_contents()
except ValueError: except ValueError:
raise template.TemplateSyntaxError('%r requires exactly one argument: the name of a group in the PIPELINE_JS setting' % token.split_contents()[0]) raise template.TemplateSyntaxError('%r requires exactly one argument: the name of a group in the PIPELINE.JAVASVRIPT setting' % token.split_contents()[0])
return JavascriptNode(name) return JavascriptNode(name)
...@@ -31,7 +31,7 @@ def filepath_to_uri(path): ...@@ -31,7 +31,7 @@ def filepath_to_uri(path):
def guess_type(path, default=None): def guess_type(path, default=None):
for type, ext in settings.PIPELINE_MIMETYPES: for type, ext in settings.MIMETYPES:
mimetypes.add_type(type, ext) mimetypes.add_type(type, ext)
mimetype, _ = mimetypes.guess_type(path) mimetype, _ = mimetypes.guess_type(path)
if not mimetype: if not mimetype:
......
...@@ -10,7 +10,7 @@ if (sys.version_info[0], sys.version_info[1]) < (3, 2): ...@@ -10,7 +10,7 @@ if (sys.version_info[0], sys.version_info[1]) < (3, 2):
setup( setup(
name='django-pipeline', name='django-pipeline',
version='1.5.4', version='1.6.0',
description='Pipeline is an asset packaging library for Django.', description='Pipeline is an asset packaging library for Django.',
long_description=io.open('README.rst', encoding='utf-8').read() + '\n\n' + long_description=io.open('README.rst', encoding='utf-8').read() + '\n\n' +
io.open('HISTORY.rst', encoding='utf-8').read(), io.open('HISTORY.rst', encoding='utf-8').read(),
......
...@@ -60,61 +60,63 @@ TEMPLATE_DIRS = ( ...@@ -60,61 +60,63 @@ TEMPLATE_DIRS = (
local_path('templates'), local_path('templates'),
) )
PIPELINE_CSS = { PIPELINE = {
'screen': { 'STYLESHEETS': {
'source_filenames': ( 'screen': {
'pipeline/css/first.css', 'source_filenames': (
'pipeline/css/second.css', 'pipeline/css/first.css',
'pipeline/css/urls.css' 'pipeline/css/second.css',
), 'pipeline/css/urls.css'
'output_filename': 'screen.css' ),
} 'output_filename': 'screen.css'
}
PIPELINE_JS = {
'scripts': {
'source_filenames': (
'pipeline/js/first.js',
'pipeline/js/second.js',
'pipeline/js/application.js',
'pipeline/templates/**/*.jst'
),
'output_filename': 'scripts.js'
},
'scripts_async': {
'source_filenames': (
'pipeline/js/first.js',
'pipeline/js/second.js',
'pipeline/js/application.js',
'pipeline/templates/**/*.jst'
),
'output_filename': 'scripts_async.js',
'extra_context': {
'async': True,
} }
}, },
'scripts_defer': { 'JAVASCRIPT': {
'source_filenames': ( 'scripts': {
'pipeline/js/first.js', 'source_filenames': (
'pipeline/js/second.js', 'pipeline/js/first.js',
'pipeline/js/application.js', 'pipeline/js/second.js',
'pipeline/templates/**/*.jst' 'pipeline/js/application.js',
), 'pipeline/templates/**/*.jst'
'output_filename': 'scripts_defer.js', ),
'extra_context': { 'output_filename': 'scripts.js'
'defer': True, },
} 'scripts_async': {
}, 'source_filenames': (
'scripts_async_defer': { 'pipeline/js/first.js',
'source_filenames': ( 'pipeline/js/second.js',
'pipeline/js/first.js', 'pipeline/js/application.js',
'pipeline/js/second.js', 'pipeline/templates/**/*.jst'
'pipeline/js/application.js', ),
'pipeline/templates/**/*.jst' 'output_filename': 'scripts_async.js',
), 'extra_context': {
'output_filename': 'scripts_async_defer.js', 'async': True,
'extra_context': { }
'async': True, },
'defer': True, 'scripts_defer': {
'source_filenames': (
'pipeline/js/first.js',
'pipeline/js/second.js',
'pipeline/js/application.js',
'pipeline/templates/**/*.jst'
),
'output_filename': 'scripts_defer.js',
'extra_context': {
'defer': True,
}
},
'scripts_async_defer': {
'source_filenames': (
'pipeline/js/first.js',
'pipeline/js/second.js',
'pipeline/js/application.js',
'pipeline/templates/**/*.jst'
),
'output_filename': 'scripts_async_defer.js',
'extra_context': {
'async': True,
'defer': True,
}
} }
} }
} }
...@@ -131,4 +133,4 @@ TEMPLATES = [ ...@@ -131,4 +133,4 @@ TEMPLATES = [
'APP_DIRS': True, 'APP_DIRS': True,
'DIRS': TEMPLATE_DIRS, 'DIRS': TEMPLATE_DIRS,
} }
] ]
\ No newline at end of file
...@@ -24,8 +24,8 @@ class CompilerTest(TestCase): ...@@ -24,8 +24,8 @@ class CompilerTest(TestCase):
def setUp(self): def setUp(self):
default_collector.collect() default_collector.collect()
self.compiler = Compiler() self.compiler = Compiler()
self.old_compilers = settings.PIPELINE_COMPILERS self.old_compilers = settings.COMPILERS
settings.PIPELINE_COMPILERS = ['tests.tests.test_compiler.DummyCompiler'] settings.COMPILERS = ['tests.tests.test_compiler.DummyCompiler']
def test_output_path(self): def test_output_path(self):
output_path = self.compiler.output_path("js/helpers.coffee", "js") output_path = self.compiler.output_path("js/helpers.coffee", "js")
...@@ -44,4 +44,4 @@ class CompilerTest(TestCase): ...@@ -44,4 +44,4 @@ class CompilerTest(TestCase):
def tearDown(self): def tearDown(self):
default_collector.clear() default_collector.clear()
settings.PIPELINE_COMPILERS = self.old_compilers settings.COMPILERS = self.old_compilers
...@@ -11,15 +11,13 @@ except ImportError: ...@@ -11,15 +11,13 @@ except ImportError:
from unittest.mock import patch # noqa from unittest.mock import patch # noqa
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings
from pipeline.compressors import Compressor, TEMPLATE_FUNC, \ from pipeline.compressors import Compressor, TEMPLATE_FUNC, \
SubProcessCompressor SubProcessCompressor
from pipeline.compressors.yuglify import YuglifyCompressor from pipeline.compressors.yuglify import YuglifyCompressor
from pipeline.collector import default_collector from pipeline.collector import default_collector
from tests.utils import _, pipeline_settings
from tests.utils import _
class CompressorTest(TestCase): class CompressorTest(TestCase):
...@@ -93,16 +91,20 @@ class CompressorTest(TestCase): ...@@ -93,16 +91,20 @@ class CompressorTest(TestCase):
'templates\\') 'templates\\')
self.assertEqual(name, 'photo_detail') self.assertEqual(name, 'photo_detail')
@override_settings(PIPELINE_TEMPLATE_SEPARATOR='/') from pipeline.conf import DEFAULTS
pipeline_settings = DEFAULTS.copy()
pipeline_settings['TEMPLATE_SEPARATOR'] = '/'
def test_template_name_separator(self): def test_template_name_separator(self):
name = self.compressor.template_name('templates/photo/detail.jst', with pipeline_settings(TEMPLATE_SEPARATOR='/'):
'templates/') name = self.compressor.template_name('templates/photo/detail.jst',
self.assertEqual(name, 'photo/detail') 'templates/')
name = self.compressor.template_name('templates/photo_edit.jst', '') self.assertEqual(name, 'photo/detail')
self.assertEqual(name, 'photo_edit') name = self.compressor.template_name('templates/photo_edit.jst', '')
name = self.compressor.template_name('templates\photo\detail.jst', self.assertEqual(name, 'photo_edit')
'templates\\') name = self.compressor.template_name('templates\photo\detail.jst',
self.assertEqual(name, 'photo/detail') 'templates\\')
self.assertEqual(name, 'photo/detail')
def test_compile_templates(self): def test_compile_templates(self):
templates = self.compressor.compile_templates([_('pipeline/templates/photo/list.jst')]) templates = self.compressor.compile_templates([_('pipeline/templates/photo/list.jst')])
......
...@@ -49,13 +49,13 @@ class StorageTest(TestCase): ...@@ -49,13 +49,13 @@ class StorageTest(TestCase):
staticfiles_storage._setup() staticfiles_storage._setup()
def test_post_process_dry_run(self): def test_post_process_dry_run(self):
with pipeline_settings(PIPELINE_JS_COMPRESSOR=None, PIPELINE_CSS_COMPRESSOR=None): with pipeline_settings(JS_COMPRESSOR=None, CSS_COMPRESSOR=None):
processed_files = PipelineStorage().post_process({}, True) processed_files = PipelineStorage().post_process({}, True)
self.assertEqual(list(processed_files), []) self.assertEqual(list(processed_files), [])
def test_post_process(self): def test_post_process(self):
storage = PipelineStorage() storage = PipelineStorage()
with pipeline_settings(PIPELINE_JS_COMPRESSOR=None, PIPELINE_CSS_COMPRESSOR=None): with pipeline_settings(JS_COMPRESSOR=None, CSS_COMPRESSOR=None):
processed_files = storage.post_process({}) processed_files = storage.post_process({})
self.assertTrue(('screen.css', 'screen.css', True) in processed_files) self.assertTrue(('screen.css', 'screen.css', True) in processed_files)
self.assertTrue(('scripts.js', 'scripts.js', True) in processed_files) self.assertTrue(('scripts.js', 'scripts.js', True) in processed_files)
...@@ -64,8 +64,8 @@ class StorageTest(TestCase): ...@@ -64,8 +64,8 @@ class StorageTest(TestCase):
""" """
Test post_process with a storage that doesn't implement the path method. Test post_process with a storage that doesn't implement the path method.
""" """
with override_settings(STATICFILES_STORAGE='tests.tests.test_storage.PipelineNoPathStorage', PIPELINE_COMPILERS=['tests.tests.test_storage.DummyCSSCompiler']): with override_settings(STATICFILES_STORAGE='tests.tests.test_storage.PipelineNoPathStorage'):
with pipeline_settings(PIPELINE_JS_COMPRESSOR=None, PIPELINE_CSS_COMPRESSOR=None): with pipeline_settings(JS_COMPRESSOR=None, CSS_COMPRESSOR=None, COMPILERS=['tests.tests.test_storage.DummyCSSCompiler']):
staticfiles_storage._setup() staticfiles_storage._setup()
try: try:
call_command('collectstatic', verbosity=0, interactive=False) call_command('collectstatic', verbosity=0, interactive=False)
......
[tox] [tox]
envlist = envlist =
py27-1.7.X, pypy-1.7.X, py34-1.7.X, {py27,pypy,py34}-django{18,19}
py27, pypy, py34, py35-1.9
docs docs
[testenv] [testenv]
downloadcache = {toxworkdir}/_download/ basepython =
py27: python2.7
pypy: pypy
py34: python3.4
py35: python3.5
deps =
py{27,py}: mock
py{27,py}: futures
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
jinja2
setenv = setenv =
DJANGO_SETTINGS_MODULE = tests.settings DJANGO_SETTINGS_MODULE = tests.settings
PYTHONPATH = {toxinidir} PYTHONPATH = {toxinidir}
commands = commands =
{envbindir}/django-admin.py test {posargs:tests} {envbindir}/django-admin.py test {posargs:tests}
[testenv:py26-1.7.X]
basepython = python2.7
deps =
Django>=1.7, <1.8
mock
jinja2
futures
[testenv:py27-1.7.X]
basepython = python2.7
deps =
Django>=1.7, <1.8
mock
jinja2
futures
[testenv:py33-1.7.X]
basepython = python3.3
deps =
Django>=1.7, <1.8
jinja2
[testenv:py34-1.7.X]
basepython = python3.4
deps =
Django>=1.7, <1.8
jinja2
[testenv:pypy-1.7.X]
basepython = pypy
deps =
Django>=1.7, <1.8
mock
jinja2
futures
[testenv:py27]
basepython = python2.7
deps =
Django>=1.8, <1.9
mock
jinja2
futures
[testenv:pypy]
basepython = pypy
deps =
Django>=1.8, <1.9
mock
jinja2
futures
[testenv:py33]
basepython = python3.3
deps =
jinja2
Django>=1.8, <1.9
[testenv:py34]
basepython = python3.4
deps =
jinja2
Django>=1.8, <1.9
[testenv:docs] [testenv:docs]
basepython = python2.7 basepython = python2.7
changedir = docs changedir = docs
......
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