In order to use django-resources you first have to register some CSS or Javascript files. You can do this via the provided utility methods:
from resources.utils import register_resource
from resources.config import CSS
from resources.config import JS
register_resource("/path/to/css_sheet_1.css", type=CSS, merge=True, minify=True, group=None, media="screen", position=10)
register_resource("/path/to/css_sheet_2.css", type=CSS, merge=True, minify=True, group=None, media="screen, print", position=20)
register_resource("/path/to/javascript_1.js", type=JS, merge=True, minify=True, group=None, position=20)
Which means:
In order to create merged and minfied resources out of registered ones, just call:
http://localhost:8000/create-resources
In order to use the registered resources whithin your HTML use the provided tags:
<html>
<head>
{% css %}
{% javascript %}
<head>
</head>
This will render the merged and minified global css and javascript sheets.
With groups you can group specific resources together. Alle resources which have the same group and registered with merged = True are merged together:
from resources.utils import register_resource
from resources.config import CSS
register_resource("/path/to/css_sheet_1.css", type=CSS, merge=True, minify=True, group="main", position=10)
register_resource("/path/to/css_sheet_2.css", type=CSS, merge=True, minify=True, group="main", position=20)
register_resource("/path/to/css_sheet_3.css", type=CSS, merge=True, minify=True, group="manage", position=10)
register_resource("/path/to/css_sheet_4.css", type=CSS, merge=True, minify=True, group="manage", position=20)
That means:
In order to use the registered resources for a specific group whithin your HTML use the provided tags:
<html>
<head>
{% css 'main' %}
<head>
</head>
This will render the merged and minified css sheets for the group main.