minwebhelpers – Welcome to MinificationWebHelpers’s documentation!

Author:Pedro Algarvio <ufs_REMOVE@ME_ufsoft.org>
Maintainer:Domen Kozar <domen_REMOVE@ME_dev.si>
Bug tracker:bitbucket.org/issues

Consider the MinificationWebHelpers an extension to WebHelpers.

Basicaly MinificationWebHelpers adds following options to the WebHelpers javascript_link and stylesheet_link functions:

  • minified (bool): Minifies/reduces as much as possible each of the files passed to it’s minimum size to reduce page load times.
  • combined (bool): Joins all files passed into a single one to reduce server requests which in turn reduces page load times.
  • beaker_kwargs (dict): override default arguments that will be passed to beaker_cache.
  • combined_filename (string): Name of the filename that will be used in conjunction with combined=True

For complete list of additional parameters reffer to base_link().


Running Pylons/TG application in debug mode will force minfied and combined options off.


For an up-to-date read of the documentation, always reffer to offical documentation page on site.

Details about implementation

MinificationWebHelpers cache your javascript and css files through Beaker‘s @beaker.cache decorator. Default parameters passed to beaker cache:

beaker_kwargs = dict(key='sources', expire='never', type='memory')

Javascript minification is achieved through Python port of jsmin.

MinificationWebHelpers maps HTTP URLs to filesystem path by exaiming pylons config for static_files.


On your own Pylons application, inside <app>/lib/helpers.py you add:

from minwebhelpers import *

Then, inside a template you could have:

  ${ h.javascript_link('/js/file1.js',
                                                                                               combined_filename='all_javascript_files') }
  ${ h.stylesheet_link('/css/style1.css',
                       beaker_kwargs=dict(invalidate_on_startup=False)) }

The above would mean file1.js and file2.js would be combined and then minimized (same story for css files).


It’s as easy as:

sudo easy_install MinificationWebHelpers

Or if you wish to install current trunk:

sudo easy_install http://bitbucket.org/iElectric/minificationwebhelpers/get/tip.zip


Indices and tables