From f7c72433cd6e96c52f1dd2cc87cf9e669b60cec6 Mon Sep 17 00:00:00 2001 From: Jayaram R Pai Date: Sat, 4 Oct 2014 17:30:23 +0530 Subject: started compressing css/js/html --- .gitignore | 1 + requirements.txt | 8 ++++++++ scipy/settings.py | 17 ++++++++++++++++- static/CACHE/.notempty | 0 static/website/css/main.css | 3 --- static/website/templates/base.html | 12 +++++++++++- static/website/templates/home.html | 10 +++++++++- 7 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 static/CACHE/.notempty diff --git a/.gitignore b/.gitignore index a490f4d..76ae659 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ config.py wsgi.py static/uploads +static/CACHE diff --git a/requirements.txt b/requirements.txt index 0e0cef2..6a4da03 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,16 @@ +BeautifulSoup==3.2.1 Django==1.5 MySQL-python==1.2.5 argparse==1.2.1 +beautifulsoup4==4.3.2 +cssmin==0.2.0 distribute==0.7.3 +django-appconf==0.6 +django-compressor==1.4 django-dajax==0.9.2 django-dajaxice==0.6 +django-htmlmin==0.7.0 django-widget-tweaks==1.3 +html5lib==1.0b3 +six==1.8.0 wsgiref==0.1.2 diff --git a/scipy/settings.py b/scipy/settings.py index f8c72ef..b817bfe 100644 --- a/scipy/settings.py +++ b/scipy/settings.py @@ -85,8 +85,10 @@ STATICFILES_DIRS = ( STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', + # 'django.contrib.staticfiles.finders.DefaultStorageFinder', + # Contrib finders. 'dajaxice.finders.DajaxiceFinder', + 'compressor.finders.CompressorFinder', ) # Make this unique, and don't share it with anybody. @@ -107,6 +109,9 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', + # Contrib middlewares. + 'htmlmin.middleware.HtmlMinifyMiddleware', + 'htmlmin.middleware.MarkRequestMiddleware', ) ROOT_URLCONF = 'scipy.urls' @@ -138,9 +143,12 @@ INSTALLED_APPS = ( 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', + # Contrib apps. 'widget_tweaks', 'dajaxice', 'dajax', + 'compressor', + # Custom apps. 'website', ) @@ -172,3 +180,10 @@ LOGGING = { }, } } +COMPRESS_ROOT = os.path.join(BASE_DIR, 'static') +COMPRESS_ENABLED = True +HTML_MINIFY = True +COMPRESS_CSS_FILTERS = [ + 'compressor.filters.cssmin.CSSMinFilter' +] + diff --git a/static/CACHE/.notempty b/static/CACHE/.notempty new file mode 100644 index 0000000..e69de29 diff --git a/static/website/css/main.css b/static/website/css/main.css index ff89ce4..0840e59 100644 --- a/static/website/css/main.css +++ b/static/website/css/main.css @@ -7,7 +7,6 @@ } body { background-color: #f3f1ea; - background-image: url('../images/ecailles.png'); } #page-wrapper { max-width: 960px; @@ -42,7 +41,6 @@ body { } #header{ height: 300px; - background: url("../images/jumbo_bg.jpg"); background-attachment: fixed; color: #ffffff; } @@ -132,7 +130,6 @@ body { } #page-header { height: 100px; - background: url("../images/jumbo_bg.jpg"); background-attachment: fixed; color: #ffffff; } diff --git a/static/website/templates/base.html b/static/website/templates/base.html index 9d02164..64febfd 100755 --- a/static/website/templates/base.html +++ b/static/website/templates/base.html @@ -1,4 +1,5 @@ {% load static %} +{% load compress %} {% load dajaxice_templatetags %} {% load tags %} @@ -8,7 +9,15 @@ SciPy India 2014 + {% compress css %} + + + {% endcompress %} {% dajaxice_js_import %} @@ -95,8 +104,9 @@ - +{% compress js %} +{% endcompress %} -