diff --git a/.gitignore b/.gitignore index 1b2db7b..7f0e148 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -*CACHE* \ No newline at end of file +*CACHE* +dist +MANIFEST \ No newline at end of file diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..740d6a5 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,4 @@ +Christian Metts + +Django Compressor's filters started life as the filters from Andreas Pelme's +django-compress. \ No newline at end of file diff --git a/LICENSE b/LICENSE index 2d16b63..b73e818 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ django_compressor ---------------- +----------------- Copyright (c) 2009 Christian Metts Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..80b58c3 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include AUTHORS +include README.rst +include LICENSE +recursive-include compressor/templates/compressor *.html \ No newline at end of file diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..b8b262a --- /dev/null +++ b/README.rst @@ -0,0 +1,68 @@ +Django compressor +================= + +Compresses linked and inline javascript or CSS into a single cached file. + +Syntax:: + + {% compress %} + + {% endcompress %} + +Examples:: + + {% compress css %} + + + + {% endcompress %} + +Which would be rendered something like:: + + + +or:: + + {% compress js %} + + + {% endcompress %} + +Which would be rendered something like:: + + + +Linked files must be on your COMPRESS_URL (which defaults to MEDIA_URL). +If DEBUG is true off-site files will throw exceptions. If DEBUG is false +they will be silently stripped. + +If COMPRESS is False (defaults to the opposite of DEBUG) the compress tag +simply returns exactly what it was given, to ease development. + + +Settings +******** + +Django compressor has a number of settings that control it's behavior. +They've been given sensible defaults. + +`COMPRESS` default: the opposite of `DEBUG` + Boolean that decides if compression will happen. + +`COMPRESS_URL` default: `MEDIA_URL` + Controls the URL that linked media will be read from and compressed media + will be written to. + +`COMPRESS_ROOT` default: `MEDIA_ROOT` + Controls the absolute file path that linked media will be read from and + compressed media will be written to. + +`COMPRESS_OUTPUT_DIR` default: `CACHE` + Conttrols the directory inside `COMPRESS_ROOT` that compressed files will + be written to. + +`COMPRESS_CSS_FILTERS` default: [] + A list of filters that will be applied to CSS. + +`COMPRESS_JS_FILTERS` default: ['compressor.filters.jsmin.JSMinFilter']) + A list of filters that will be applied to javascript. diff --git a/compressor/conf/settings.py b/compressor/conf/settings.py index cddf610..a441e61 100644 --- a/compressor/conf/settings.py +++ b/compressor/conf/settings.py @@ -4,7 +4,6 @@ from django.conf import settings MEDIA_URL = getattr(settings, 'COMPRESS_URL', settings.MEDIA_URL) MEDIA_ROOT = getattr(settings, 'COMPRESS_ROOT', settings.MEDIA_ROOT) -PREFIX = getattr(settings, 'COMPRESS_PREFIX', 'compressed') OUTPUT_DIR = getattr(settings, 'COMPRESS_OUTPUT_DIR', 'CACHE') COMPRESS = getattr(settings, 'COMPRESS', not settings.DEBUG) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e7a20a1 --- /dev/null +++ b/setup.py @@ -0,0 +1,34 @@ +import os +from distutils.core import setup + +def read(fname): + return open(os.path.join(os.path.dirname(__file__), fname)).read() + +README = read('README.rst') + +setup( + name = "django_compressor", + version = "0.5", + url = 'http://github.com/mintchaos/django_compressor', + license = 'BSD', + description = "Compresses linked and inline javascript or CSS into a single cached file.", + long_description=README, + + author = 'Christian Metts', + author_email = 'xian@mintchaos.com', + packages = [ + 'compressor', + 'compressor.filters', + 'compressor.filters.jsmin', + 'compressor.templatetags', + ], + classifiers = [ + 'Development Status :: 4 - Beta', + 'Framework :: Django', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Topic :: Internet :: WWW/HTTP', + ] +)