forked from django-compressor/django-compressor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
114 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
*CACHE* | ||
*CACHE* | ||
dist | ||
MANIFEST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Christian Metts | ||
|
||
Django Compressor's filters started life as the filters from Andreas Pelme's | ||
django-compress. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include AUTHORS | ||
include README.rst | ||
include LICENSE | ||
recursive-include compressor/templates/compressor *.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Django compressor | ||
================= | ||
|
||
Compresses linked and inline javascript or CSS into a single cached file. | ||
|
||
Syntax:: | ||
|
||
{% compress <js/css> %} | ||
<html of inline or linked JS/CSS> | ||
{% endcompress %} | ||
|
||
Examples:: | ||
|
||
{% compress css %} | ||
<link rel="stylesheet" href="/media/css/one.css" type="text/css" charset="utf-8"> | ||
<style type="text/css">p { border:5px solid green;}</style> | ||
<link rel="stylesheet" href="/media/css/two.css" type="text/css" charset="utf-8"> | ||
{% endcompress %} | ||
|
||
Which would be rendered something like:: | ||
|
||
<link rel="stylesheet" href="/media/CACHE/css/f7c661b7a124.css" type="text/css" media="all" charset="utf-8"> | ||
|
||
or:: | ||
|
||
{% compress js %} | ||
<script src="/media/js/one.js" type="text/javascript" charset="utf-8"></script> | ||
<script type="text/javascript" charset="utf-8">obj.value = "value";</script> | ||
{% endcompress %} | ||
|
||
Which would be rendered something like:: | ||
|
||
<script type="text/javascript" src="/media/CACHE/js/3f33b9146e12.js" charset="utf-8"></script> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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', | ||
] | ||
) |