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 asset-bender

How to install asset_bender

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install asset-bender
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
0.1.15 Available View build log
 
License
LICENSE.txt
Lastest release
version 0.1.15 on Jan 9th, 2014

## Usage:

First, make sure you've installed asset_bender: https://github.com/HubSpot/asset_bender/tree/master

Secondly, make sure that PROJ_NAME, PROJ_DIR, BENDER_S3_DOMAIN, and BENDER_CDN_DOMAIN are set in your settings. PROJ_NAME should match the name in static_conf.json and PROJ_DIR needs to point to the python module path (via something like PROJ_DIR = dirname(realpath(__file__))).

BENDER_S3_DOMAIN is the domain that points to your S3 bucket and BENDER_CDN_DOMAIN is the CDN domain in front of S3 (if you have one).

Thirdly, make sure that you've included these lines in your Manifest.in:

global-include static_conf.json global-include prebuilt_recursive_static_conf.json

Next, in your app's context processor do:

```python from django.template import RequestContext from asset_bender.bundling import BenderAssets

System Message: WARNING/2 (<string>, line 20); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 20); backlink

Inline interpreted text or phrase reference start-string without end-string.
def my_context_processor(request):

context = RequestContext(request)

bender_assets = BenderAssets([

'my_project/static/js/my_project_bundle.js', 'my_project/static/css/my_project_bundle.css',

'some_library/static/js/some_library_bundle.js', 'some_library/static/css/some_library_bundle.js'

... etc ...

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

Block quote ends without a blank line; unexpected unindent.

], request.GET)

context.update(bender_assets.generate_context_dict()) return context

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

Definition list ends without a blank line; unexpected unindent.

```

System Message: WARNING/2 (<string>, line 39); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 39); backlink

Inline interpreted text or phrase reference start-string without end-string.

And lastly, in your base template you'll need to include these templates:

```html <head>

System Message: WARNING/2 (<string>, line 44); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 44); backlink

Inline interpreted text or phrase reference start-string without end-string.

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

Unexpected indentation.
... {% include "asset_bender/scaffold/head.html" %} ...

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

Block quote ends without a blank line; unexpected unindent.

</head>

<body>
... {% include "asset_bender/scaffold/end_of_body.html" %}

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

Definition list ends without a blank line; unexpected unindent.

</body> ```

System Message: WARNING/2 (<string>, line 54); backlink

Inline literal start-string without end-string.

System Message: WARNING/2 (<string>, line 54); backlink

Inline interpreted text or phrase reference start-string without end-string.

To manually include a particular static asset in your HTML, use the template tag:

` {% load asset_bender_tags %} {% bender_url "project_name/static/js/my-file.js" %} `

The tag will output a full url with the proper domain and version number (as specified by this projects's dependencies).

Subscribe to package updates

Last updated Jan 9th, 2014

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.