tgext.minify

CSS and JS minifier for TurboGears2
Download

tgext.minify Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Simone Marzola
  • Publisher web site:
  • http://bitbucket.org/simock85/

tgext.minify Tags


tgext.minify Description

tgext.minify is a Turbogears 2 middleware that minifies all css and JavaScript files in your public directory before serving them. Based on rCSSmin and rJSmin by André Malo. The middleware is based on tgext.scss by Alessandro Molina.Installingtgext.scss can be installed both from pypi or from bitbucket:easy_install tgext.minifyshould just work for most of the usersEnabling tgext.minifyIf tgext.pluggable is available enabling tgext.minify is just a matter of appending to your config/app_cfg.py:from tgext.pluggable import plugplug(base_config, 'tgext.minify')Otherwise manually using tgext.minify is really simple, you edit your config/middeware.py and just after the #Wrap your base TurboGears 2 application with custom middleware here comment wrap app with MinifyMiddleware:from tgext.minify import MinifyMiddlewaremake_base_app = base_config.setup_tg_wsgi_app(load_environment)def make_app(global_conf, full_stack=True, **app_conf): app = make_base_app(global_conf, full_stack=True, **app_conf) # Wrap your base TurboGears 2 application with custom middleware here app = MinifyMiddleware(app) return appNow you just have to put your beautiful .css and .js files inside public/ and they will be served as minified.Performance boostHere is the report of a benchmark made on paster serving bootstrap.css with and without the middleware and then bootstrap.min.js already minified (without using the middleware):$ /usr/sbin/ab -n 1000 http://localhost:8080/css/bootstrap.cssRequests per second: 1135.50 (mean)$ /usr/sbin/ab -n 1000 http://localhost:8080/css/bootstrap.cssRequests per second: 714.99 (mean)$ /usr/sbin/ab -n 1000 http://localhost:8080/css/bootstrap.min.cssRequests per second: 806.26 (mean)In these case serving the unminified css using tgext.minify is even faster than directly serving the same css file as it is served from memory (due to caching performed by tgext.minify).Product's homepage


tgext.minify Related Software