Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install minimatic

How to install Minimatic

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install minimatic
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.0 Available View build log
Windows (64-bit)
1.0 Available View build log
Mac OS X (10.5+)
1.0 Available View build log
Linux (32-bit)
1.0 Available View build log
Linux (64-bit)
1.0 Available View build log
 
Imports
Lastest release
version 1.0 on Jan 5th, 2011

An extension to WebHelpers that enables a real time JS/CSS combination and minification in production mode.

Installation

Using easy_install:

$ easy_install minimatic

Using pip:

$ pip install minimatic

Source code

Mercurial repository is located at bitbucket.org.

Usage

It extends the WebHelpers functions javascript_link and stylesheet_link to take a modified set of parameters:

  • sources (list): JS/CSS items to process. Each item is one of the following:
  • (dict) with keys:
  • file: a path to the source file relative to the static file root
  • minify: minification method. Possible values (default False):
  • False (bool): use the source unmodified
  • strip (str): only strip extra whitespace and comments (applicable

System Message: WARNING/2 (<string>, line 35)

Bullet list ends without a blank line; unexpected unindent.

to CSS only) * minify (str): strip whitespace and apply other possible JS/CSS minifications. Note that this involves source parsing and will err on syntax errors (CSS hacks will be removed!). In effect the resulting file may be logically different * dest: if the source list is not combined then each item must provide a destination filename relative to the static file root * (str): it will be treated as (see above):

{'file': (str), 'minify': False}
  • combined (str): the combined filename relative to the static file root.

System Message: WARNING/2 (<string>, line 47)

Bullet list ends without a blank line; unexpected unindent.

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.

Example

Mix and match the sources into one big JS file:

>>> javascript_link(

System Message: ERROR/3 (<string>, line 63)

Inconsistent literal block quoting.

... # 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(

System Message: ERROR/3 (<string>, line 75)

Inconsistent literal block quoting.

... # 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)

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:3

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.