Features
- Pure Python asset manager
- Python 3 support
Installation
pip install django-easyasset
Configuration
settings.py
INSTALLED_APPS = ( ... 'django.contrib.staticfiles', 'easyasset', ... ) # it is used by "manage.py collectstatic" STATICFILES_FINDERS = ( ... 'easyasset.finders.EasyAssetFinder', ) EASYASSET_RULES = { 'css/all.css': { 'sources': [ 'components/*.css', 'blocks/*/*.css', ], 'ignore': [ 'blocks/*/*.ie*.css', ], }, 'css/ie8.css': { 'sources': [ 'blocks/*/*.ie8.css', ], }, 'js/all.js': { 'sources': [ 'blocks/*/*.js', ] } } # if you would like to minify css and js files EASYASSET_COMPRESS = True
urls.py
from django.conf.urls.static import static from easyasset.views import easyasset_static_serve urlpatterns = patterns('', # your urls ) # add static url with argument view=easyasset_static_serve urlpatterns += static(settings.STATIC_URL, view=easyasset_static_serve)
templates
{% load staticfiles %} <link rel="stylesheet" href="{% static 'css/all.css' %}"> <script src="{% static 'js/all.js' %}"></script>
Runserver
manage.py runserver --nostatic