Add django-compressor #1

This commit is contained in:
Yohan Boniface 2012-12-22 12:42:29 +01:00
parent 23a51324b6
commit a70f8cb4ee
5 changed files with 34 additions and 5 deletions

2
fabfile.py vendored
View file

@ -163,7 +163,7 @@ def collectstatic():
""" """
collect_remote_statics() collect_remote_statics()
dj('collectstatic --link --noinput') dj('collectstatic --link --noinput')
# dj('compress') dj('compress')
# with cd('{virtualenv_dir}/var/static'.format(**env)): # with cd('{virtualenv_dir}/var/static'.format(**env)):
# fix_permissions() # fix_permissions()

View file

@ -9,4 +9,5 @@ django==1.4.2
git+git://github.com/petry/django-foundation.git git+git://github.com/petry/django-foundation.git
git+git://github.com/yohanboniface/django-chickpea.git git+git://github.com/yohanboniface/django-chickpea.git
git+git://github.com/frankban/django-endless-pagination.git git+git://github.com/frankban/django-endless-pagination.git
hg+https://bitbucket.org/liberation/sesql hg+https://bitbucket.org/liberation/sesql
django_compressor

View file

@ -30,6 +30,7 @@ INSTALLED_APPS = (
'endless_pagination', 'endless_pagination',
'youmap', 'youmap',
'sesql', 'sesql',
'compressor',
#'south', #'south',
@ -95,6 +96,10 @@ STATICFILES_DIRS = (
os.path.join(PROJECT_DIR, 'static'), os.path.join(PROJECT_DIR, 'static'),
) )
STATICFILES_FINDERS += (
'compressor.finders.CompressorFinder',
)
#============================================================================== #==============================================================================
# Templates # Templates
#============================================================================== #==============================================================================
@ -129,3 +134,5 @@ AUTHENTICATION_BACKENDS += (
#============================================================================== #==============================================================================
# Third party app settings # Third party app settings
#============================================================================== #==============================================================================
COMPRESS_ENABLED = True
COMPRESS_OFFLINE = True

View file

@ -1,20 +1,21 @@
{% load compress %}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>{% block head_title %}u{Map}{% endblock %}</title> <title>{% block head_title %}u{Map}{% endblock %}</title>
<meta charset="utf-8"> <meta charset="utf-8">
{% compress css %}
<!-- Included CSS Files (Compressed) --> <!-- Included CSS Files (Compressed) -->
<link rel="stylesheet" href="{{ STATIC_URL }}foundation/stylesheets/foundation.css"> <link rel="stylesheet" href="{{ STATIC_URL }}foundation/stylesheets/foundation.css">
<link rel="stylesheet" href="{{ STATIC_URL }}youmap/youmap.css"> <link rel="stylesheet" href="{{ STATIC_URL }}youmap/youmap.css">
<script src="{{ STATIC_URL }}foundation/javascripts/modernizr.foundation.js"></script> <script src="{{ STATIC_URL }}foundation/javascripts/modernizr.foundation.js"></script>
{% endcompress css %}
<!-- IE Fix for HTML5 Tags --> <!-- IE Fix for HTML5 Tags -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]--> <![endif]-->
{% block extra_head %} {% block extra_head %}
<link rel="stylesheet" href="{{ STATIC_URL }}storage/contrib/css/storage.ui.default.css">
{% endblock extra_head %} {% endblock extra_head %}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</head> </head>
@ -24,7 +25,7 @@
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div> </div>
{% compress js %}
<script src="{{ STATIC_URL }}foundation/javascripts/modernizr.foundation.js"></script> <script src="{{ STATIC_URL }}foundation/javascripts/modernizr.foundation.js"></script>
<script src="{{ STATIC_URL }}foundation/javascripts/jquery.js"></script> <script src="{{ STATIC_URL }}foundation/javascripts/jquery.js"></script>
<script src="{{ STATIC_URL }}foundation/javascripts/jquery.foundation.mediaQueryToggle.js"></script> <script src="{{ STATIC_URL }}foundation/javascripts/jquery.foundation.mediaQueryToggle.js"></script>
@ -39,6 +40,7 @@
<script src="{{ STATIC_URL }}foundation/javascripts/jquery.placeholder.js"></script> <script src="{{ STATIC_URL }}foundation/javascripts/jquery.placeholder.js"></script>
<script src="{{ STATIC_URL }}foundation/javascripts/jquery.foundation.alerts.js"></script> <script src="{{ STATIC_URL }}foundation/javascripts/jquery.foundation.alerts.js"></script>
<script src="{{ STATIC_URL }}endless_pagination/js/endless-pagination.js"></script> <script src="{{ STATIC_URL }}endless_pagination/js/endless-pagination.js"></script>
{% endcompress js %}
{% block bottom_js %} {% block bottom_js %}
<script src="{{ STATIC_URL }}storage/contrib/js/storage.ui.default.js"></script> <script src="{{ STATIC_URL }}storage/contrib/js/storage.ui.default.js"></script>
{% endblock %} {% endblock %}

View file

@ -0,0 +1,19 @@
{% extends "base.html" %}
{% load chickpea_tags compress %}
{% block title %}{{ map.name }}{% endblock %}
{% block extra_head %}
{% compress css %}
{% chickpea_css %}
{% endcompress %}
{% compress js %}
{% chickpea_js %}
{% endcompress %}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
{% endblock %}
{% block content %}
{% block map_init %}
{% include "chickpea/map_init.html" %}
{% endblock %}
{% endblock %}