Minimatic is a project mainly written in Python, it's free.
CSS and Javascript Minification/Combination Upgrade to WebHelpers
An extension to WebHelpers_ that enables a real time JS/CSS combination and minification in production mode.
Using easy_install::
$ easy_install minimatic
Using pip::
$ pip install minimatic
Git repository is located at GitHub.com_.
It extends the WebHelpers_ functions javascriptlink and stylesheetlink to take a modified set of parameters:
sources (list): JS/CSS items to process. Each item is one of the following:
(str): it will be treated as (see above)::
{'file': (str), 'minify': False}
combined (str): the combined filename relative to the static file root. Implies that the files need to be combined. If combined is None then every Item must have a dest key provided.
beaker_kwargs (dict): override default arguments that will be passed to
beaker_cache
. beaker_kwargs.update()
is issued on default arguments.
timestamp append time.time
timestamp to links to force browsers reload
the JS/CSS assets, eg. test.js?t=123012343
The files will be combined in production mode; in development mode (debug=True) they will be served unmodified separately.
Mix and match the sources into one big JS file::
>>> javascript_link(
... # These files are already minified; combine them only
... '/js/jquery.js',
... '/js/jquery-ui-custom.js',
... # These are custom files which need to be minified first
... dict(file='/js/base.js', minify='minify'),
... dict(file='/js/page-script.js', minify='minify'),
... combined='/combined/js/scripts.js',
... timestamp=True)
Serve CSS files separately (uncombined)::
>>> stylesheet_link(
... # This stylesheet is valid CSS and safe to parse and minify
... dict(file='/css/base.css', minify='minify',
... dest='/combined/css/base.css'),
... # This stylesheet is full of CSS hacks and only the extra whitespace
... # and comments should be stripped
... dict(file='/css/styles.ie6.css', minify='strip',
... dest='/combined/css/styles.ie6.css'),
... timestamp=True)
.. _WebHelpers: http://pylonshq.com/docs/en/0.9.7/thirdparty/webhelpers/ .. _javascript_link: http://pylonshq.com/docs/en/0.9.7/thirdparty/webhelpers/html/html/#webhelpers.html.tags.javascript_link .. _stylesheet_link: http://pylonshq.com/docs/en/0.9.7/thirdparty/webhelpers/html/html/#webhelpers.html.tags.stylesheet_link .. _GitHub.com: http://github.com/kaukas/Minimatic