Skip to content

Commit

Permalink
Added compressor
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Oordt committed Aug 26, 2011
1 parent 4b4c406 commit 1bafd92
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
12 changes: 12 additions & 0 deletions settings.py
Expand Up @@ -124,6 +124,7 @@
'django.contrib.redirects',
'disqus',
'bookmarks',
'compressor',
)

TEMPLATE_LOADERS = (
Expand Down Expand Up @@ -254,6 +255,7 @@
'staticfiles.finders.FileSystemFinder',
'staticfiles.finders.AppDirectoriesFinder',
'staticfiles.finders.LegacyAppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
Expand All @@ -274,6 +276,16 @@

TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, 'js', 'tiny_mce')
TINYMCE_JS_URL = "%sjs/tiny_mce/tiny_mce.js" % STATIC_URL

COMPRESS_ENABLED = True
COMPRESS_CSS_FILTERS = [
'compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.datauri.DataUriFilter',
'compressor.filters.cssmin.CSSMinFilter',
]
COMPRESS_DATA_URI_MAX_SIZE = 3000
COMPRESS_OFFLINE = True

try:
from local_settings import *
except ImportError:
Expand Down
8 changes: 6 additions & 2 deletions setup/fabfile.py
Expand Up @@ -58,7 +58,11 @@ def update_site():
docs_path = os.path.join(site_path, 'doc_src')
with cd(site_path):
run('git pull --all')
run('workon djangopatterns && pip install -r %s/setup/requirements.txt' % site_path)
run('workon djangopatterns && %s/manage.py syncdb' % site_path)
# run('workon djangopatterns && %s/manage.py migrate' % site_path)
run('workon djangopatterns && %s/manage.py collectstatic --noinput' % site_path)
run('workon djangopatterns && %s/manage.py compress' % site_path)
with cd(docs_path):
run('git pull --all')
# run('workon djangopatterns && cd doc_src && make clean')
Expand All @@ -73,6 +77,6 @@ def update_docs():
docs_path = os.path.join(site_path, 'doc_src')
with cd(docs_path):
run('git reset --hard && git pull --all')
# run('workon djangopatterns && cd doc_src && make clean')
# run('workon djangopatterns && cd doc_src && make json')
run('workon djangopatterns && cd doc_src && make clean')
run('workon djangopatterns && cd doc_src && make json')

3 changes: 2 additions & 1 deletion setup/requirements.txt
Expand Up @@ -10,4 +10,5 @@ django-staticfiles==1.0.1
django-disqus==0.4.1

--extra-index-url=http://callowayproject.com/simple/
django-bookmarks==0.2.1
django-bookmarks==0.2.1
django-compressor==0.9.2
14 changes: 6 additions & 8 deletions templates/base.html
@@ -1,4 +1,5 @@
{%spaceless%}
{% load compress %}
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
Expand All @@ -18,10 +19,11 @@

<!-- CSS
================================================== -->
{% compress css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/base.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/skeleton.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/layout.css">

{% endcompress %}
<!-- Favicons
================================================== -->
<link rel="shortcut icon" href="{{ STATIC_URL }}img/favicon.ico">
Expand Down Expand Up @@ -56,14 +58,10 @@
<div id="footer">{% block footer %}{% endblock %}</div>
</div> {# container #}
{% endblock body_outer %}{% spaceless %}
{% compress js %}
<script src="{{ STATIC_URL }}js/hyphenator.js" type="text/javascript"></script>
<!-- JS
================================================== -->
<script src="{{ STATIC_URL }}/js/app.js"></script>

<!-- End Document
================================================== -->

<script src="{{ STATIC_URL }}js/app.js"></script>
{% endcompress %}
{% block extra_body_base %}
{% block extra_body %}{% endblock %}
{% endblock %}
Expand Down
6 changes: 3 additions & 3 deletions templates/docs/doc.html
@@ -1,9 +1,12 @@
{% extends "docs/base_docs.html" %}
{% load compress %}
{% block head_title %}{{ doc.title|striptags|safe }}{% endblock %}
{% block extra_head %}
{{ block.super }}
{% compress css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/docutils.css" type="text/css" />
<link rel="stylesheet" href="{{ STATIC_URL }}css/pygments.css" type="text/css" />
{% endcompress %}
{% endblock %}

{% block body %}
Expand All @@ -22,6 +25,3 @@
{% load disqus_tags %}
{% disqus_show_comments %}
{% endblock body %}
{% block extra_body_base %}
{{ block.super }}
{% endblock extra_body_base %}

0 comments on commit 1bafd92

Please sign in to comment.