# HG changeset patch # User ymh # Date 1391300363 -3600 # Node ID 95d84db2c351cf36b57a96e663172c79a66dcf48 # Parent 53fd14f2babd33de428fa5e8e4ce3be66c2a4e76 add css and js compression diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/config.py.tmpl --- a/src/jocondelab/config.py.tmpl Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/config.py.tmpl Sun Feb 02 01:19:23 2014 +0100 @@ -78,6 +78,8 @@ # Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = BASE_STATIC_URL + 'site/' +STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' + # Make this unique, and don't share it with anybody. SECRET_KEY = '%(secret_key)s' @@ -155,3 +157,8 @@ CACHE_MIDDLEWARE_SECONDS = 600 HOME_CACHE_SECONDS = 30 + +#PIPELINE_ENABLED = not DEBUG +PIPELINE_CSS_COMPRESSOR = "pipeline.compressors.yuglify.YuglifyCompressor" +PIPELINE_JS_COMPRESSOR = "pipeline.compressors.yuglify.YuglifyCompressor" + diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/settings.py --- a/src/jocondelab/settings.py Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/settings.py Sun Feb 02 01:19:23 2014 +0100 @@ -103,6 +103,8 @@ # 'django.contrib.staticfiles.finders.DefaultStorageFinder', ) +STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' + # Make this unique, and don't share it with anybody. SECRET_KEY = '' @@ -169,6 +171,7 @@ 'django.contrib.admin', 'south', 'mptt', + 'pipeline', 'core', 'jocondelab', ) @@ -273,6 +276,138 @@ CACHE_MIDDLEWARE_SECONDS = 600 HOME_CACHE_SECONDS = 30 +BASE_CSS = ('jocondelab/css/smoothness/jquery-ui-1.10.3.custom.min.css', 'jocondelab/lib/jquery.tagit.css', 'jocondelab/css/front-common.css') + +PIPELINE_CSS = { + 'front-base': { + 'source_filenames': BASE_CSS, + 'output_filename': 'jocondelab/css/front-base.min.css', + }, + 'front-credits': { + 'source_filenames': BASE_CSS + ( + 'jocondelab/css/front-credits.css', + ), + 'output_filename': 'jocondelab/css/front-credit.min.css', + }, + 'front-timeline': { + 'source_filenames': BASE_CSS + ( + 'jocondelab/css/front-timeline.css', + ), + 'output_filename': 'jocondelab/css/front-timeline.min.css', + }, + 'front-termlist': { + 'source_filenames': BASE_CSS + ( + 'jocondelab/css/front-termlist.css', + ), + 'output_filename': 'jocondelab/css/front-termlist.min.css', + }, + 'front-notice': { + 'source_filenames': BASE_CSS + ( + 'jocondelab/lib/magnific-popup.css', + 'jocondelab/css/front-notice.css' + ), + 'output_filename': 'jocondelab/css/front-notice.min.css', + }, + 'front-geo': { + 'source_filenames': BASE_CSS + ( + 'jocondelab/lib/leaflet.css', + 'jocondelab/lib/L.Control.Zoomslider.css', + 'jocondelab/css/front-geo.css', + ), + 'output_filename': 'jocondelab/css/front-geo.min.css', + }, + 'front-home': { + 'source_filenames': BASE_CSS + ( + 'jocondelab/css/front-home.css', + ), + 'output_filename': 'jocondelab/css/front-home.min.css', + }, + 'front-students': { + 'source_filenames': BASE_CSS + ( + 'jocondelab/css/front-students.css', + ), + 'output_filename': 'jocondelab/css/front-students.min.css', + }, + 'front-students-group': { + 'source_filenames': BASE_CSS + ( + 'jocondelab/css/front-students.css', + ), + 'output_filename': 'jocondelab/css/front-students-group.min.css', + }, +} + + +BASE_JS = ( + 'jocondelab/lib/underscore-min.js', + 'jocondelab/lib/jquery.min.js' , + 'jocondelab/lib/jquery-ui.min.js', + 'jocondelab/lib/jquery.ui.touch-punch.min.js', + 'jocondelab/lib/tag-it.min.js', + 'jocondelab/js/front-common.js', +) +BASE_JS_SEARCH = BASE_JS + ( + 'jocondelab/js/front-search.js', +) + +PIPELINE_JS = { + 'front-geo': { + 'source_filenames': BASE_JS + ( + 'jocondelab/lib/leaflet.js', + 'jocondelab/lib/L.Control.Zoomslider.js', + 'jocondelab/lib/oms.min.js', + 'jocondelab/js/front-geo.js', + ), + 'output_filename': 'jocondelab/js/front-geo.min.js', + }, + 'front-home': { + 'source_filenames': BASE_JS_SEARCH + ( + 'jocondelab/js/front-home.js', + ), + 'output_filename': 'jocondelab/js/front-home.min.js', + }, + 'front-notice': { + 'source_filenames': BASE_JS + ( + 'jocondelab/lib/jquery.magnific-popup.min.js', + 'jocondelab/js/front-notice.js', + ), + 'output_filename': 'jocondelab/js/front-notice.min.js', + }, + 'front-search': { + 'source_filenames': BASE_JS_SEARCH, + 'output_filename': 'jocondelab/js/front-search.min.js', + }, + 'front-students-group': { + 'source_filenames': BASE_JS + ( + 'jocondelab/lib/videojs/video.js', + ), + 'output_filename': 'jocondelab/js/front-students-group.min.js', + }, + 'front-students': { + 'source_filenames': BASE_JS + ( + 'jocondelab/lib/videojs/video.js', + ), + 'output_filename': 'jocondelab/js/front-students.min.js', + }, + 'front-termlist': { + 'source_filenames': BASE_JS + ( + 'jocondelab/js/front-termlist.js', + ), + 'output_filename': 'jocondelab/js/front-termlist.min.js', + }, + 'front-timeline': { + 'source_filenames': BASE_JS + ( + 'jocondelab/lib/jquery.mousewheel.js', + 'jocondelab/lib/hammer.min.js', + 'jocondelab/js/front-timeline.js', + ), + 'output_filename': 'jocondelab/js/front-timeline.min.js', + }, +} + +PIPELINE_CSS_COMPRESSOR = "pipeline.compressors.yuglify.YuglifyCompressor" +PIPELINE_JS_COMPRESSOR = "pipeline.compressors.yuglify.YuglifyCompressor" + + from config import * # @UnusedWildImport if not "SRC_BASE_URL" in locals(): diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/static/jocondelab/js/front-common.js --- a/src/jocondelab/static/jocondelab/js/front-common.js Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/static/jocondelab/js/front-common.js Sun Feb 02 01:19:23 2014 +0100 @@ -479,7 +479,6 @@ }; window.loadSearchResults = function(query) { - console.log('window.loadSearchResults'); $(".hide-on-search").hide(); $win.off("scroll.ajaxload"); $(".wiki-info img").off("load error"); diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/templates/jocondelab/front_base.html --- a/src/jocondelab/templates/jocondelab/front_base.html Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/templates/jocondelab/front_base.html Sun Feb 02 01:19:23 2014 +0100 @@ -1,5 +1,7 @@ {% load i18n %} {% load static %} +{% load compressed %} + {% get_language_info for LANGUAGE_CODE as current_lang %} @@ -9,26 +11,13 @@ {% block title %}JocondeLab{% endblock %} - - {% block js_import %} - - - - - - - {% endblock %} - + {% block css_import %} - - - {% endblock %} - - {% block css_declaration %} - + {% compressed_css 'front-base' %} {% endblock %} {% block js_declaration %} + - + {% endblock %} + {% block js_import %} + {% endblock %} + + {% block css_declaration %} {% endblock %} {% endblock %} diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/templates/jocondelab/front_credits.html --- a/src/jocondelab/templates/jocondelab/front_credits.html Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/templates/jocondelab/front_credits.html Sun Feb 02 01:19:23 2014 +0100 @@ -1,10 +1,14 @@ {% extends "jocondelab/front_base.html" %} {% load i18n %} {% load static %} +{% load compressed %} -{% block css_declaration %} - {{block.super}} - + +{% block css_import %} + {% compressed_css 'front-credits' %} +{% endblock %} + +{% block js_declaration %} {% endblock %} {% block title %}JocondeLab » {% trans 'Crédits' %}{% endblock %} diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/templates/jocondelab/front_geo.html --- a/src/jocondelab/templates/jocondelab/front_geo.html Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/templates/jocondelab/front_geo.html Sun Feb 02 01:19:23 2014 +0100 @@ -1,18 +1,14 @@ {% extends "jocondelab/front_base.html" %} {% load i18n %} {% load static %} +{% load compressed %} {% block js_import %} - {{block.super}} - - - + {% compressed_js 'front-geo' %} {% endblock %} {% block css_import %} - {{block.super}} - - + {% compressed_css 'front-geo' %} {% endblock %} {% block js_declaration %} @@ -25,13 +21,8 @@ urls.countries_geo_json = "{% static 'jocondelab/lib/countries.geo.json' %}"; var countries = {{countries|safe}}; - {% endblock %} -{% block css_declaration %} - {{block.super}} - -{% endblock %} {% block title %}JocondeLab » {% trans 'Mappemonde' %}{% endblock %} diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/templates/jocondelab/front_home.html --- a/src/jocondelab/templates/jocondelab/front_home.html Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/templates/jocondelab/front_home.html Sun Feb 02 01:19:23 2014 +0100 @@ -1,15 +1,14 @@ {% extends "jocondelab/front_search.html" %} {% load i18n %} +{% load compressed %} {% load static %} -{% block js_declaration %} -{{block.super}} - +{% block js_import %} + {% compressed_js 'front-home' %} {% endblock %} -{% block css_declaration %} -{{block.super}} - +{% block css_import %} + {% compressed_css 'front-home' %} {% endblock %} {% block title %}JocondeLab » {% trans 'Accueil' %}{% endblock %} diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/templates/jocondelab/front_legal.html --- a/src/jocondelab/templates/jocondelab/front_legal.html Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/templates/jocondelab/front_legal.html Sun Feb 02 01:19:23 2014 +0100 @@ -5,6 +5,8 @@ {% block breadcrumbs %}{% trans 'Mentions légales' %}{% endblock %} +{% block js_declaration %}{% endblock %} + {% block main %}

Mentions légales JocondeLab

diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/templates/jocondelab/front_notice.html --- a/src/jocondelab/templates/jocondelab/front_notice.html Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/templates/jocondelab/front_notice.html Sun Feb 02 01:19:23 2014 +0100 @@ -2,10 +2,10 @@ {% load i18n %} {% load jlutils %} {% load static %} +{% load compressed %} {% block js_import %} - {{block.super}} - + {% compressed_js 'front-notice' %} {% endblock %} {% block js_declaration %} @@ -18,18 +18,12 @@ urls.downvote = "{% url 'ajax_downvote' %}"; urls.wikipedia = {{wikipedia_urls|safe}}; - {% endblock %} {% block css_import %} - {{block.super}} - + {% compressed_css 'front-notice' %} {% endblock %} -{% block css_declaration %} - {{block.super}} - -{% endblock %} {% block title %}JocondeLab » {% trans "Détail d'une notice" %}{% endblock %} diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/templates/jocondelab/front_search.html --- a/src/jocondelab/templates/jocondelab/front_search.html Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/templates/jocondelab/front_search.html Sun Feb 02 01:19:23 2014 +0100 @@ -1,6 +1,7 @@ {% extends "jocondelab/front_base.html" %} {% load i18n %} {% load static %} +{% load compressed %} {% block js_declaration %} {{block.super}} @@ -8,7 +9,10 @@ var queryobj = {% if queryobj %}{{queryobj|safe}}{% else %}null{% endif %}, uri_cache = {% if uri_cache %}{{uri_cache|safe}}{% else %}{}{% endif %}; - +{% endblock %} + +{% block js_import %} + {% compressed_js 'front-search' %} {% endblock %} {% block title %}JocondeLab » {% if searchterms_label %}{% blocktrans %}Résultats pour : « {{searchterms_label}} »{% endblocktrans %}{% else %}{% trans 'Recherche' %}{% endif %}{% endblock %} diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/templates/jocondelab/front_students.html --- a/src/jocondelab/templates/jocondelab/front_students.html Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/templates/jocondelab/front_students.html Sun Feb 02 01:19:23 2014 +0100 @@ -1,17 +1,16 @@ {% extends "jocondelab/front_base.html" %} {% load i18n %} {% load static %} +{% load compressed %} -{% block css_declaration %} - {{block.super}} - +{% block css_import %} + {% compressed_css 'front-students' %} {% endblock %} {% block title %}JocondeLab » {% trans "Galerie de créations" %}{% endblock %} -{% block breadcrumbs %}{% trans "Galerie de créations" %}{% endblock %} - {% block js_declaration %} + {% compressed_js 'front-students' %} {{block.super}} {% endblock %} +{% block js_import %} +{% endblock %} + +{% block breadcrumbs %}{% trans "Galerie de créations" %}{% endblock %} {% block main %}
diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/templates/jocondelab/front_students_group.html --- a/src/jocondelab/templates/jocondelab/front_students_group.html Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/templates/jocondelab/front_students_group.html Sun Feb 02 01:19:23 2014 +0100 @@ -1,15 +1,14 @@ {% extends "jocondelab/front_base.html" %} {% load i18n %} {% load static %} +{% load compressed %} {% block js_import %} - {{block.super}} - {% endblock %} + {% block css_import %} - {{block.super}} - + {% compressed_css 'front-students-group' %} {% endblock %} @@ -18,6 +17,7 @@ {% block breadcrumbs %}{% trans "Galerie de créations" %}{% endblock %} {% block js_declaration %} + {% compressed_js 'front-students-group' %} {{block.super}} +{% block js_import %} + {% compressed_js 'front-termlist' %} {% endblock %} -{% block css_declaration %} - {{block.super}} - +{% block css_import %} + {% compressed_css 'front-termlist' %} {% endblock %} {% block title %}JocondeLab » {% trans 'Mots-clés' %}{% endblock %} diff -r 53fd14f2babd -r 95d84db2c351 src/jocondelab/templates/jocondelab/front_timeline.html --- a/src/jocondelab/templates/jocondelab/front_timeline.html Thu Jan 30 17:09:23 2014 +0100 +++ b/src/jocondelab/templates/jocondelab/front_timeline.html Sun Feb 02 01:19:23 2014 +0100 @@ -1,11 +1,10 @@ {% extends "jocondelab/front_base.html" %} {% load i18n %} {% load static %} +{% load compressed %} {% block js_import %} - {{block.super}} - - + {% compressed_js 'front-timeline' %} {% endblock %} {% block js_declaration %} @@ -13,12 +12,10 @@ - {% endblock %} -{% block css_declaration %} - {{block.super}} - +{% block css_import %} + {% compressed_css 'front-timeline' %} {% endblock %} {% block title %}JocondeLab » {% trans 'Chronologie' %}{% endblock %} diff -r 53fd14f2babd -r 95d84db2c351 virtualenv/res/lib/lib_create_env.py --- a/virtualenv/res/lib/lib_create_env.py Thu Jan 30 17:09:23 2014 +0100 +++ b/virtualenv/res/lib/lib_create_env.py Sun Feb 02 01:19:23 2014 +0100 @@ -37,6 +37,7 @@ 'HTML5LIB': {'setup': 'html5lib','url':'https://github.com/html5lib/html5lib-python/archive/1.0b1.tar.gz', 'local': 'html5lib-1.0b1.tar.gz', 'install' : {'method':'pip', 'option_str': None, 'dict_extra_env': None}}, 'WIKITOOLS' : { 'setup': 'wikitools', 'url': 'wikitools-1.1.1.tar.bz2', 'local': 'wikitools-1.1.1.tar.bz2', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, 'MPTT' : { 'setup': 'django-mptt', 'url': 'https://codeload.github.com/django-mptt/django-mptt/tar.gz/master', 'local': 'django-mptt-0.5.-dev.tar.bz2', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, + 'PIPELINE' : { 'setup': 'django-pipeline', 'url': 'https://github.com/cyberdelia/django-pipeline/archive/1.3.20.tar.gz', 'local': 'django-pipeline-1.3.20.tar.gz', 'install': {'method': 'pip', 'option_str': None, 'dict_extra_env': None}}, } if system_str == 'Windows': diff -r 53fd14f2babd -r 95d84db2c351 virtualenv/res/src/django-pipeline-1.3.20.tar.gz Binary file virtualenv/res/src/django-pipeline-1.3.20.tar.gz has changed diff -r 53fd14f2babd -r 95d84db2c351 virtualenv/web/res/requirement.txt --- a/virtualenv/web/res/requirement.txt Thu Jan 30 17:09:23 2014 +0100 +++ b/virtualenv/web/res/requirement.txt Sun Feb 02 01:19:23 2014 +0100 @@ -7,6 +7,7 @@ django-extensions==1.1.1 django-haystack==2.0.0 django-mptt==0.5.-dev +django-pipeline==1.3.20 html5lib==1.0b1 isodate==0.4.9 lxml==3.2.1 diff -r 53fd14f2babd -r 95d84db2c351 virtualenv/web/res/res_create_env.py --- a/virtualenv/web/res/res_create_env.py Thu Jan 30 17:09:23 2014 +0100 +++ b/virtualenv/web/res/res_create_env.py Sun Feb 02 01:19:23 2014 +0100 @@ -29,6 +29,7 @@ # 'RDFLIB-SQLALCHEMY', # 'WIKITOOLS', # 'MPTT', +# 'PIPELINE', ] if system_str == "Linux":