Skip to main content

Assets management for django

Project description

Install

pip install django-assets-manager

Usage

Settings

INSTALLED_APPS = (
        # ...
        'django_assets_manager',
)

STATICFILES_FINDERS = (
        'django.contrib.staticfiles.finders.FileSystemFinder',
        'django.contrib.staticfiles.finders.AppDirectoriesFinder',
        'django_assets_manager.finders.CdnFinder',
)

ASSETS_MANAGER_FILES = {
        "utils": {
                "js": "static://js/utils.js",
        },
        "cooleffect": {
                "js": ["static://js/cooleffect.js"],
                "css": ["static://css/cooleffect.css"],
                "depends": ["utils", "jquery"],
        },
        "jquery": {
                "js": "//code.jquery.com/jquery-2.1.4.min.js",
                "cache": {
                        "paths": {
                                "//code.jquery.com/jquery-2.1.4.min.js": "jquery-2.1.4.min.js",
                        }
                },
        },
}

ASSETS_MANAGER_SPRITES = (
        {
                'name': 'main',
                'output': 'images/sprites.png',
                'scss_output': 'css/_sprites.scss',
                'extra_sizes': ((2, '@2x'),),
                'width': 640,
                'height': 640,
                'images': (
                        {
                                'name': 'logo',
                                'src': 'img/logo.png',
                        },
                        {
                                'name': 'bar_bg',
                                'src': 'img/bar_bg.png',
                                'mode': 'repeat-x',
                        },
                ),
        },
)

Template

{% load assets_manager %}
{% assets "cooleffect" %}
<!-- or -->
{% assets_css "cooleffect" %}
{% assets_js "cooleffect" %}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_assets_manager-1.0.0.tar.gz (19.9 kB view hashes)

Uploaded Source

Built Distribution

django_assets_manager-1.0.0-py3-none-any.whl (11.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page