4/11/2014 - 6:15 AM


source ""
gem "jammit"
gem "closure-compiler"
# Put this file in core/management/commands/ (or other app of your choice).
# -*- coding: utf-8 -*-
from subprocess import call

from import BaseCommand, CommandError
from import call_command

class Command(BaseCommand):
    help = "Collect static files and create assets."
    def handle(self, **options):
        call_command('collectstatic', link=True, interactive=False)
        # staticfiles's finders will not find assets if they are put
        # in public/assets/ (symlink to static/assets/) directly. This is
        # also why we override STATICFILES_DIRS in
        call(['jammit', '--output', 'jammit/assets', '--force'])
# Put this file in config/ dir.
embed_assets: datauri
javascript_compressor: closure
compress_assets: on

# Change javascripts and stylesheets as appropriate.
        - public/js/jquery-1.*.min.js
        - public/js/jquery.*.js
        - public/pinax/**/*.js
        - public/js/*.js

        - public/pinax/**/*.css
        - public/uni_form/uni-form.css
        - public/css/*.css
mkdir jammit config

# CSS url() paths get broken without this symlink in the current version
# of Jammit (0.6.2). This is also why we write public/ instead of static/
# in config/assets.yml.
ln -s static public

# After all files beneath have been created.
bundle install # see Gemfile and read up on Ruby's bundler if you get errors here
python assets
# Needed after first run to get workspace.css and .js into static/assets/ dir.
python collectstatic -l

# Change templates to include {{STATIC_URL}}assets/workspace-datauri.css
# and {{STATIC_URL}}assets/workspace.js.
# Relevant settings are listed beneath.
import os.path
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
MEDIA_ROOT = os.path.join(PROJECT_ROOT, "media")
MEDIA_URL = "/media/"
STATIC_ROOT = os.path.join(PROJECT_ROOT, "static")
STATIC_URL = "/static/"

    os.path.join(PROJECT_ROOT, "jammit"),

# Replace "core" with where you put mgmt command.