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
- Unobtrusvie Foldable Admin Interface by whiteinge 5 years, 3 months ago
- Template tags to integrate with modconcat by matthanger 3 years, 10 months ago
- Template tag for compressed CSS & JS (GAE version) by jeffar 4 years, 10 months ago
- YUI Loader as Django middleware by akaihola 5 years, 1 month ago
- Search Docs with Shortwave by baumer1122 4 years, 10 months ago
Comments