From f37e390fcbf3e026225ef0712f57469b404256a2 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 2 Jan 2012 18:23:46 +0530 Subject: [PATCH] create gzip version of js files --- etc/nginx/vhost.in | 1 + pandora/app/config.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/etc/nginx/vhost.in b/etc/nginx/vhost.in index 0708fe1a9..f92689f59 100644 --- a/etc/nginx/vhost.in +++ b/etc/nginx/vhost.in @@ -5,6 +5,7 @@ server { #those need to go into /etc/nginx/nginx.conf in the http section #gzip on; + #gzip_static on; #gzip_http_version 1.1; #gzip_vary on; #gzip_comp_level 6; diff --git a/pandora/app/config.py b/pandora/app/config.py index 422da3bc3..b3d32b245 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -91,6 +91,15 @@ def update_static(): with open(pandora_json, 'w') as f: json.dump(sorted(js), f, indent=2) + for f in (pandora_js, pandora_json): + os.system('gzip -9 -c "%s" > "%s.gz"' % (f, f)) + + for root, folders, files in os.walk(os.path.join(settings.STATIC_ROOT, 'oxjs/build')): + for f in files: + if os.path.splitext(f)[-1] in ('.js', '.json'): + f = os.path.join(root, f) + os.system('gzip -9 -c "%s" > "%s.gz"' % (f, f)) + for size in (16, 64, 256): pandora = os.path.join(settings.STATIC_ROOT, 'png/pandora/icon%d.png'%size) image = os.path.join(settings.STATIC_ROOT, 'png/icon%d.png'%size)