diff --git a/compressor/contrib/sekizai.py b/compressor/contrib/sekizai.py new file mode 100644 index 0000000..57ced6b --- /dev/null +++ b/compressor/contrib/sekizai.py @@ -0,0 +1,18 @@ +""" + source: https://gist.github.com/1311010 + Get django-sekizai, django-compessor (and django-cms) playing nicely together + re: https://github.com/ojii/django-sekizai/issues/4 + using: https://github.com/jezdez/django_compressor.git + and: https://github.com/ojii/django-sekizai.git@0.5 +""" +from compressor.templatetags.compress import CompressorNode +from django.template.base import Template + + +def compress(context, data, name): + """ + Data is the string from the template (the list of js files in this case) + Name is either 'js' or 'css' (the sekizai namespace) + Basically passes the string through the {% compress 'js' %} template tag + """ + return CompressorNode(nodelist=Template(data).nodelist, kind=name, mode='file').render(context=context) diff --git a/docs/django-sekizai.txt b/docs/django-sekizai.txt new file mode 100644 index 0000000..c47b2bf --- /dev/null +++ b/docs/django-sekizai.txt @@ -0,0 +1,22 @@ +django-sekizai Support +============== + +Django Compressor comes with support for _django-sekizai via an extension. +_django-sekizai provides the ability to include template code, from within +any block, to a parent block. It is primarily used to include js/css from +included templates to the master template. + +It requires _django-sekizai to installed. Refer to the _django-sekizai _docs +for how to use ``render_block`` + +Usage +-------------- + +.. code-block:: django + + {% load sekizai_tags %} + {% render_block "" postprocessor "compressor.contrib.sekizai.compress" %} + + +.. _django-sekizai: https://github.com/ojii/django-sekizai +.. _docs: http://django-sekizai.readthedocs.org/en/latest/ diff --git a/docs/index.txt b/docs/index.txt index 6fb524d..f1adfa4 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -42,5 +42,6 @@ Contents remote-storages behind-the-scenes jinja2 + django-sekizai contributing changelog