diff --git a/DjangoBlog/settings.py b/DjangoBlog/settings.py index c45127d..a7c5c93 100644 --- a/DjangoBlog/settings.py +++ b/DjangoBlog/settings.py @@ -43,7 +43,8 @@ INSTALLED_APPS = [ 'blog', 'accounts', 'comments', - 'oauth' + 'oauth', + 'compressor' ] MIDDLEWARE_CLASSES = [ @@ -272,3 +273,26 @@ LOGGING = { }, } } + + + +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', + #other + 'compressor.finders.CompressorFinder', +) +COMPRESS_ENABLED = True +#COMPRESS_OFFLINE = True + +""" +COMPRESS_CSS_FILTERS = [ + #creates absolute urls from relative ones + 'compressor.filters.css_default.CssAbsoluteFilter', + #css minimizer + 'compressor.filters.cssmin.CSSMinFilter' +] +COMPRESS_JS_FILTERS = [ + 'compressor.filters.jsmin.JSMinFilter' +] +""" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 64266d6..c00bddd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,5 @@ Unidecode Whoosh mistune pygments -django-ipware \ No newline at end of file +django-ipware +django_compressor \ No newline at end of file diff --git a/templates/share_layout/base.html b/templates/share_layout/base.html index 7db1549..8cc2fd8 100644 --- a/templates/share_layout/base.html +++ b/templates/share_layout/base.html @@ -1,5 +1,6 @@ {% load static %} {% load cache %} +{% load compress %} - - - - - {% comment %}{% endcomment %} - - + + {% block compress_css %} + {% endblock %} + {% endcompress %} {% comment %} {% endcomment %} - - + {% compress js %} + + {% endcompress %}
@@ -88,8 +90,12 @@ var wpAutoTopSpeed = 1; {% comment %} {% endcomment %} - - + {% compress js %} + + + {% block compress_js %} + {% endblock %} + {% endcompress %} {% block footer %} {% endblock %} diff --git a/templates/share_layout/base_account.html b/templates/share_layout/base_account.html index e1df7d6..d95a1ad 100644 --- a/templates/share_layout/base_account.html +++ b/templates/share_layout/base_account.html @@ -11,19 +11,22 @@