django-slimmer 0.0.2

HTML compression as middleware and view decorators

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
MIT/X Consortium License 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Harley Bussell
HOMEPAGE:
github.com
CATEGORY:
ROOT \ Internet \ HTTP (WWW)
django-slimmer is a Django conversion of CheckoutableTemplates Zope package: http://zope.org/Members/peterbe/CheckoutableTemplates

The slimmer is taken directly from the Zope package, with django middleware and a view decorator added.

The slimming process takes html and removes whitespace, optimizes inline css, removes oneline comments. The end result can be a significant file size reduction even after the page is served with gzip compression.

Installation:

sudo easy_install django-slimmer

Install middleware

'slimmer.middleware.CompressHtmlMiddleware',

Or you can use a view decorator to compress specific views

from slimmer.decorator import compress_html

@compress_html
def browse(request):
 context = RequestContext(request,{})
 return render_to_response('browse.html',context)


Using the slimmer directly

from slimmer import slimmer
compressed = slimmer.xhtml_slimmer(html)

Last updated on February 13th, 2010

requirements

#HTML compression #middleware decorators #view decorators #HTML #compression #middleware #decorators

Add your review!

SUBMIT