]> review.fuel-infra Code Review - packages/trusty/python-django-compressor.git/blob - python-django-compressor/compressor/contrib/sekizai.py
Add python-compressor package to MOS 8.0 repository
[packages/trusty/python-django-compressor.git] / python-django-compressor / compressor / contrib / sekizai.py
1 """
2  source: https://gist.github.com/1311010
3  Get django-sekizai, django-compessor (and django-cms) playing nicely together
4  re: https://github.com/ojii/django-sekizai/issues/4
5  using: https://github.com/django-compressor/django-compressor.git
6  and: https://github.com/ojii/django-sekizai.git@0.6 or later
7 """
8 from compressor.templatetags.compress import CompressorNode
9 from django.template.base import Template
10
11
12 def compress(context, data, name):
13     """
14     Data is the string from the template (the list of js files in this case)
15     Name is either 'js' or 'css' (the sekizai namespace)
16     Basically passes the string through the {% compress 'js' %} template tag
17     """
18     return CompressorNode(nodelist=Template(data).nodelist, kind=name, mode='file').render(context=context)