Skip to content

Commit ac2d39f

Browse files
committed
Packaging and a README
1 parent 90da0c1 commit ac2d39f

File tree

7 files changed

+114
-3
lines changed

7 files changed

+114
-3
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
*CACHE*
1+
*CACHE*
2+
dist
3+
MANIFEST

AUTHORS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Christian Metts
2+
3+
Django Compressor's filters started life as the filters from Andreas Pelme's
4+
django-compress.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
django_compressor
2-
---------------
2+
-----------------
33
Copyright (c) 2009 Christian Metts <xian@mintchaos.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include AUTHORS
2+
include README.rst
3+
include LICENSE
4+
recursive-include compressor/templates/compressor *.html

README.rst

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
Django compressor
2+
=================
3+
4+
Compresses linked and inline javascript or CSS into a single cached file.
5+
6+
Syntax::
7+
8+
{% compress <js/css> %}
9+
<html of inline or linked JS/CSS>
10+
{% endcompress %}
11+
12+
Examples::
13+
14+
{% compress css %}
15+
<link rel="stylesheet" href="/media/css/one.css" type="text/css" charset="utf-8">
16+
<style type="text/css">p { border:5px solid green;}</style>
17+
<link rel="stylesheet" href="/media/css/two.css" type="text/css" charset="utf-8">
18+
{% endcompress %}
19+
20+
Which would be rendered something like::
21+
22+
<link rel="stylesheet" href="/media/CACHE/css/f7c661b7a124.css" type="text/css" media="all" charset="utf-8">
23+
24+
or::
25+
26+
{% compress js %}
27+
<script src="/media/js/one.js" type="text/javascript" charset="utf-8"></script>
28+
<script type="text/javascript" charset="utf-8">obj.value = "value";</script>
29+
{% endcompress %}
30+
31+
Which would be rendered something like::
32+
33+
<script type="text/javascript" src="/media/CACHE/js/3f33b9146e12.js" charset="utf-8"></script>
34+
35+
Linked files must be on your COMPRESS_URL (which defaults to MEDIA_URL).
36+
If DEBUG is true off-site files will throw exceptions. If DEBUG is false
37+
they will be silently stripped.
38+
39+
If COMPRESS is False (defaults to the opposite of DEBUG) the compress tag
40+
simply returns exactly what it was given, to ease development.
41+
42+
43+
Settings
44+
********
45+
46+
Django compressor has a number of settings that control it's behavior.
47+
They've been given sensible defaults.
48+
49+
`COMPRESS` default: the opposite of `DEBUG`
50+
Boolean that decides if compression will happen.
51+
52+
`COMPRESS_URL` default: `MEDIA_URL`
53+
Controls the URL that linked media will be read from and compressed media
54+
will be written to.
55+
56+
`COMPRESS_ROOT` default: `MEDIA_ROOT`
57+
Controls the absolute file path that linked media will be read from and
58+
compressed media will be written to.
59+
60+
`COMPRESS_OUTPUT_DIR` default: `CACHE`
61+
Conttrols the directory inside `COMPRESS_ROOT` that compressed files will
62+
be written to.
63+
64+
`COMPRESS_CSS_FILTERS` default: []
65+
A list of filters that will be applied to CSS.
66+
67+
`COMPRESS_JS_FILTERS` default: ['compressor.filters.jsmin.JSMinFilter'])
68+
A list of filters that will be applied to javascript.

compressor/conf/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
MEDIA_URL = getattr(settings, 'COMPRESS_URL', settings.MEDIA_URL)
66
MEDIA_ROOT = getattr(settings, 'COMPRESS_ROOT', settings.MEDIA_ROOT)
7-
PREFIX = getattr(settings, 'COMPRESS_PREFIX', 'compressed')
87
OUTPUT_DIR = getattr(settings, 'COMPRESS_OUTPUT_DIR', 'CACHE')
98

109
COMPRESS = getattr(settings, 'COMPRESS', not settings.DEBUG)

setup.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import os
2+
from distutils.core import setup
3+
4+
def read(fname):
5+
return open(os.path.join(os.path.dirname(__file__), fname)).read()
6+
7+
README = read('README.rst')
8+
9+
setup(
10+
name = "django_compressor",
11+
version = "0.5",
12+
url = 'http://github.com/mintchaos/django_compressor',
13+
license = 'BSD',
14+
description = "Compresses linked and inline javascript or CSS into a single cached file.",
15+
long_description=README,
16+
17+
author = 'Christian Metts',
18+
author_email = 'xian@mintchaos.com',
19+
packages = [
20+
'compressor',
21+
'compressor.filters',
22+
'compressor.filters.jsmin',
23+
'compressor.templatetags',
24+
],
25+
classifiers = [
26+
'Development Status :: 4 - Beta',
27+
'Framework :: Django',
28+
'Intended Audience :: Developers',
29+
'License :: OSI Approved :: BSD License',
30+
'Operating System :: OS Independent',
31+
'Programming Language :: Python',
32+
'Topic :: Internet :: WWW/HTTP',
33+
]
34+
)

0 commit comments

Comments
 (0)