1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | from django import template
from jsmin import jsmin
register = template.Library()
class MinifyJs(template.Node):
def __init__(self, nodelist):
self.nodelist = nodelist
def render(self, context):
return jsmin(self.nodelist.render(context))
def minifyjs(parser, token):
nodelist = parser.parse(('endminifyjs',))
parser.delete_first_token()
return MinifyJs(nodelist)
minifyjs = register.tag(minifyjs)
|
More like this
- Template tags to integrate with modconcat by matthanger 2 years, 6 months ago
- Google Closure support in django-compress by fabrice.bonny 2 years, 3 months ago
- escapejs block tag by baumer1122 3 years, 11 months ago
- YUI Loader as Django middleware by akaihola 3 years, 9 months ago
- Template tag for compressed CSS & JS (GAE version) by jeffar 3 years, 7 months ago
Comments