Commit f36fd86a authored by Michal Čihař's avatar Michal Čihař

Add django_compressor for merging javascript and CSS before sending out

Fixes #821
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 7990c160
...@@ -28,6 +28,8 @@ lxml (>= 3.1.0) ...@@ -28,6 +28,8 @@ lxml (>= 3.1.0)
http://lxml.de/ http://lxml.de/
dateutil dateutil
http://labix.org/python-dateutil http://labix.org/python-dateutil
django_compressor
https://github.com/django-compressor/django-compressor
libravatar (optional for federated avatar support) libravatar (optional for federated avatar support)
https://pypi.python.org/pypi/pyLibravatar https://pypi.python.org/pypi/pyLibravatar
pyuca (>= 1.1) (optional for proper sorting of strings) pyuca (>= 1.1) (optional for proper sorting of strings)
......
...@@ -7,3 +7,4 @@ python-dateutil ...@@ -7,3 +7,4 @@ python-dateutil
python-social-auth>=0.2.0 python-social-auth>=0.2.0
django-crispy-forms>=1.4.0 django-crispy-forms>=1.4.0
oauthlib>=0.6.3 oauthlib>=0.6.3
django_compressor>=1.5.0
{% load i18n %} {% load i18n %}
{% load static %} {% load static %}
{% load translations %} {% load translations %}
{% load compress %}
{% if not request.is_ajax %} {% if not request.is_ajax %}
<!DOCTYPE html> <!DOCTYPE html>
...@@ -14,6 +16,7 @@ ...@@ -14,6 +16,7 @@
<meta name="description" content="{{ description }}" /> <meta name="description" content="{{ description }}" />
{% endif %} {% endif %}
{% compress css %}
<link rel="stylesheet" type="text/css" href="{% static 'bootstrap/css/bootstrap.min.css' %}" /> <link rel="stylesheet" type="text/css" href="{% static 'bootstrap/css/bootstrap.min.css' %}" />
{% if LANGUAGE_BIDI %} {% if LANGUAGE_BIDI %}
<link rel="stylesheet" type="text/css" href="{% static 'bootstrap/css/bootstrap-rtl.min.css' %}" /> <link rel="stylesheet" type="text/css" href="{% static 'bootstrap/css/bootstrap-rtl.min.css' %}" />
...@@ -24,7 +27,9 @@ ...@@ -24,7 +27,9 @@
<link rel="stylesheet" type="text/css" href="{% static 'bootstrap/css/datepicker3.css' %}" /> <link rel="stylesheet" type="text/css" href="{% static 'bootstrap/css/datepicker3.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'chartist.min.css' %}" /> <link rel="stylesheet" type="text/css" href="{% static 'chartist.min.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'style-bootstrap.css' %}" /> <link rel="stylesheet" type="text/css" href="{% static 'style-bootstrap.css' %}" />
{% endcompress %}
<script src="{% url 'js-catalog' %}" type="text/javascript"></script> <script src="{% url 'js-catalog' %}" type="text/javascript"></script>
{% compress js %}
<script src="{% static 'js/jquery-1.11.3.min.js' %}" type="text/javascript"></script> <script src="{% static 'js/jquery-1.11.3.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/jquery.cookie.js' %}" type="text/javascript"></script> <script src="{% static 'js/jquery.cookie.js' %}" type="text/javascript"></script>
<script src="{% static 'js/jquery.autosize.min.js' %}" type="text/javascript"></script> <script src="{% static 'js/jquery.autosize.min.js' %}" type="text/javascript"></script>
...@@ -35,6 +40,7 @@ ...@@ -35,6 +40,7 @@
<script src="{% static 'bootstrap/js/bootstrap.min.js' %}" type="text/javascript"></script> <script src="{% static 'bootstrap/js/bootstrap.min.js' %}" type="text/javascript"></script>
<script src="{% static 'loader-bootstrap.js' %}" type="text/javascript"></script> <script src="{% static 'loader-bootstrap.js' %}" type="text/javascript"></script>
<script src="{% static 'js/bootstrap-datepicker.js' %}" type="text/javascript"></script> <script src="{% static 'js/bootstrap-datepicker.js' %}" type="text/javascript"></script>
{% endcompress %}
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" /> <link rel="icon" href="/favicon.ico" type="image/x-icon" />
......
...@@ -188,6 +188,16 @@ def get_versions(): ...@@ -188,6 +188,16 @@ def get_versions():
'1.4.0', '1.4.0',
)) ))
name = 'compressor'
url = 'https://github.com/django-compressor/django-compressor'
mod = get_version_module('compressor', name, url)
result.append((
name,
url,
mod.__version__,
'1.5',
))
return result return result
......
...@@ -164,6 +164,7 @@ STATICFILES_DIRS = ( ...@@ -164,6 +164,7 @@ STATICFILES_DIRS = (
STATICFILES_FINDERS = ( STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
) )
# Make this unique, and don't share it with anybody. # Make this unique, and don't share it with anybody.
...@@ -278,6 +279,7 @@ INSTALLED_APPS = ( ...@@ -278,6 +279,7 @@ INSTALLED_APPS = (
'django.contrib.sitemaps', 'django.contrib.sitemaps',
'social.apps.django_app.default', 'social.apps.django_app.default',
'crispy_forms', 'crispy_forms',
'compressor',
'weblate.trans', 'weblate.trans',
'weblate.lang', 'weblate.lang',
'weblate.accounts', 'weblate.accounts',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment