Commit 3eb067df authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch 'feature/compressed-static' into 'master'

Add django compressor

Closes #63 

Minify and combine all javascript and css files into one. Good for caching, good for speed.

See merge request !56
parents baaf4a1f bf70d014
Django==1.10
django-localflavor==1.3
Pillow
django-static-precompiler>=1.4,<2
django-compressor==2.1
django-sendfile==0.3.10
django-template-check>=0.3.0 # This should be in dev-requirements somehow
bleach==1.4.3
......
......@@ -43,10 +43,10 @@ INSTALLED_APPS = [
'django.contrib.sites',
'django.contrib.sitemaps',
# Dependencies
'static_precompiler',
'tinymce',
'django_template_check', # This is only necessary in development
'rest_framework',
'compressor',
# Our apps
'thaliawebsite', # include for admin settings
'members',
......@@ -74,7 +74,6 @@ MIDDLEWARE = [
ROOT_URLCONF = 'thaliawebsite.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
......@@ -95,7 +94,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'thaliawebsite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/dev/ref/settings/#databases
......@@ -106,7 +104,6 @@ DATABASES = {
}
}
# Password validation
# https://docs.djangoproject.com/en/dev/ref/settings/#auth-password-validators
......@@ -134,7 +131,6 @@ AUTHENTICATION_BACKENDS = [
'committees.backends.CommitteeBackend',
]
# Internationalization
# https://docs.djangoproject.com/en/dev/topics/i18n/
......@@ -155,7 +151,6 @@ LANGUAGES = [
LOCALE_PATHS = ('locale',)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/
......@@ -172,8 +167,18 @@ STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# other finders
'static_precompiler.finders.StaticPrecompilerFinder',
'compressor.finders.CompressorFinder',
)
# Compressor settings
COMPRESS_ENABLED = True
COMPRESS_PRECOMPILERS = (
('text/less', 'lessc {infile} {outfile}'),
)
COMPRESS_CSS_FILTERS = ['compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.cssmin.rCSSMinFilter']
# Precompiler settings
STATIC_PRECOMPILER_LIST_FILES = True
This diff is collapsed.
{% load i18n static compile_static menu %}
{% load i18n static menu compress %}
{% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html>
<!--[if IE 9]><html dir="ltr" lang="{{ LANGUAGE_CODE }}" class="lt-ie10"> <![endif]-->
......@@ -17,6 +17,7 @@
<!-- css stylesheets -->
{% block css_head %}
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400italic,400,700" rel="stylesheet" type="text/css">
{% compress css %}
<link href="{% static "fonts/gillsans.css" %}" rel="stylesheet" type="text/css">
<link href="{% static "plugins/font-awesome/css/font-awesome.min.css" %}" rel="stylesheet" type="text/css">
......@@ -24,18 +25,18 @@
<link href="{% static "plugins/magnific-popup/magnific-popup.css" %}" rel="stylesheet" type="text/css">
<link href="{% static "css/jquery.fancybox.css" %}" rel="stylesheet" type="text/css">
<link href="{% static "css/style.less"|compile %}" rel="stylesheet" type="text/css">
<link href="{% static "css/skin.less"|compile %}" rel="stylesheet" type="text/css">
{% endblock %}
<link href="{% static "css/style.less" %}" rel="stylesheet" type="text/less">
<link href="{% static "css/skin.less" %}" rel="stylesheet" type="text/less">
{% endcompress %}{% endblock %}
<!-- js head -->
{% block js_head %}
{% block js_head %}{% compress js %}
<script type="text/javascript" src="{% static "plugins/jquery-1.8.3.min.js" %}"></script>
<script type="text/javascript" src="{% static "js/jquery.jscroll.min.js" %}"></script>
<script type="text/javascript" src="{% static "js/jquery.fancybox.js" %}"></script>
<script type="text/javascript" src="{% static "js/thimbus.js" %}"></script>
<script type="text/javascript" src="{% static "js/scripts.js" %}"></script>
{% endblock %}
{% endcompress %}{% endblock %}
</head>
......
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