Posted by mlk on Fri 13 Jun 18:31
report abuse | download | new post
- js_mimetypes = frozenset(['text/javascript', 'application/x-javascript'])
- def jsminify_middleware(app):
- @webob_wrap
- def middleware_app(req):
- r = req.get_response(app)
- if r.content_type in js_mimetypes and r.body:
- r.decode_content()
- r.body = jsmin(r.body)
- if 'gzip' in req.accept_encoding:
- r.encode_content()
- return r
- return middleware_app
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.