Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

Django Minimizer

Django Minimizer compresses static files and provides html5 layout that is ready for extending to your project templates. It uses YUI compressor for compressing static files, and it has included Javascript files like modernizr, jquery, etc. Base template created with html5boilerplate.

This application also supports CoffeScript and LessCSS optionally. If you prefer to use CoffeeScript or LessCSS, you'll need to Node for compiling static files to .js or .css.

Requirements

Django Minimizer has no dependency other than Django, but it needs to a cache_backend for getting compressed file timestamp information. If you prefer memcached, install python-memcached package.

pip install -r requirements.txt

Other dependencies:

  • Java >= 1.4 (for YUI Compressor)
  • Node >= 0.6.0 (for CoffeeSript compiler)

Installation

  • Add djangominimizer to INSTALLED_APPS.
  • Add required template context processors for djangominimizer:
TEMPLATE_CONTEXT_PROCESSORS = (
    [...]
    'django.core.context_processors.request',
    'djangominimizer.context_processors.minimizer_settings'
)
  • Then, you should configure your cache_backend. For example:
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': [
            '127.0.0.1:11211'
        ]
    }
}
  • If you are using CoffeeScript instead of Javascript, don't forget to add this line to your settings.py:
MINIMIZER_COFFEE_SUPPORT = True

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.