aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/httpd.conf-example9
-rw-r--r--perllib/FixMyStreet/App/View/Web.pm12
-rw-r--r--templates/web/barnet/header.html10
-rw-r--r--templates/web/default/common_header_tags.html2
-rw-r--r--templates/web/default/header.html4
-rw-r--r--templates/web/default/maps/bing.html2
-rw-r--r--templates/web/default/maps/fms.html8
-rw-r--r--templates/web/default/maps/google.html2
-rw-r--r--templates/web/default/maps/osm-streetview.html8
-rw-r--r--templates/web/default/maps/osm.html8
-rw-r--r--templates/web/emptyhomes/header.html2
-rw-r--r--templates/web/fiksgatami/header.html4
-rw-r--r--templates/web/lichfielddc/header.html2
-rw-r--r--templates/web/southampton/header.html6
14 files changed, 44 insertions, 35 deletions
diff --git a/conf/httpd.conf-example b/conf/httpd.conf-example
index 378aa88a5..8ed6a9c81 100644
--- a/conf/httpd.conf-example
+++ b/conf/httpd.conf-example
@@ -16,6 +16,7 @@
# # on production servers these are run under fastcgi
# Options +ExecCGI
# AddHandler cgi-script .cgi
+# AllowOverride None
# </Directory>
#
# <Directory /home/yourname/fixmystreet/web-admin>
@@ -60,6 +61,14 @@ ProxyPassReverse /mapit/ http://mapit.mysociety.org/
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
RewriteRule /(.+) /$1 [L]
+# Performance things
+ExpiresActive On
+ExpiresByType text/css "access plus 10 years"
+ExpiresByType application/javascript "access plus 10 years"
+<Location /js/>
+ AddOutputFilter DEFLATE js
+</Location>
+
# Don't want jslib being passed to Catalyst
RewriteRule ^/jslib(.*) /jslib$1 [L,PT]
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm
index 2d0fb87d0..43d46ae25 100644
--- a/perllib/FixMyStreet/App/View/Web.pm
+++ b/perllib/FixMyStreet/App/View/Web.pm
@@ -19,7 +19,7 @@ __PACKAGE__->config(
render_die => 1,
expose_methods => [
'loc', 'nget', 'tprintf', 'display_crosssell_advert', 'prettify_epoch',
- 'add_links', 'css',
+ 'add_links', 'version',
],
FILTERS => {
escape_js => \&escape_js,
@@ -165,14 +165,14 @@ sub html_filter {
return $text;
}
-my %css_hash;
-sub css {
+my %version_hash;
+sub version {
my ( $self, $c, $file ) = @_;
- unless ($css_hash{$file}) {
+ unless ($version_hash{$file}) {
my $path = FixMyStreet->path_to('web', $file);
- $css_hash{$file} = ( stat( $path ) )[9];
+ $version_hash{$file} = ( stat( $path ) )[9];
}
- return "$file?$css_hash{$file}";
+ return "$file?$version_hash{$file}";
}
1;
diff --git a/templates/web/barnet/header.html b/templates/web/barnet/header.html
index 5055df9f0..8270154ab 100644
--- a/templates/web/barnet/header.html
+++ b/templates/web/barnet/header.html
@@ -3,7 +3,7 @@
<head>
<link rel="stylesheet" type="text/css" href="/cobrands/barnet/css/basic.css">
- <link rel="stylesheet" type="text/css" href="[% css('/css/core.css') %]">
+ <link rel="stylesheet" type="text/css" href="[% version('/css/core.css') %]">
<link rel="stylesheet" type="text/css" href="/cobrands/barnet/css/layout.css">
<!-- Preferred style sheet enabled when the page is loaded -->
@@ -41,10 +41,10 @@
<![endif]-->
<link rel="stylesheet" media="print" type="text/css" href="/cobrands/barnet/css/print.css">
- <script type="text/javascript" src="/cobrands/barnet/javascript/jquery-1.2.6_common.js"></script>
- <script type="text/javascript" src="/cobrands/barnet/javascript/styleswitch.js"></script>
- <script type="text/javascript" src="/cobrands/barnet/javascript/jquery-cookie-min.js"></script>
- <script type="text/javascript" src="/cobrands/barnet/javascript/2008-portsurf.js"></script>
+ <script type="text/javascript" src="[% version('/cobrands/barnet/javascript/jquery-1.2.6_common.js') %]"></script>
+ <script type="text/javascript" src="[% version('/cobrands/barnet/javascript/styleswitch.js') %]"></script>
+ <script type="text/javascript" src="[% version('/cobrands/barnet/javascript/jquery-cookie-min.js') %]"></script>
+ <script type="text/javascript" src="[% version('/cobrands/barnet/javascript/2008-portsurf.js') %]"></script>
[% INCLUDE 'common_header_tags.html' %]
diff --git a/templates/web/default/common_header_tags.html b/templates/web/default/common_header_tags.html
index f9048b067..d0140d69c 100644
--- a/templates/web/default/common_header_tags.html
+++ b/templates/web/default/common_header_tags.html
@@ -1,6 +1,6 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="/jslib/jquery-1.6.2.min.js"></script>
-<script type="text/javascript" src="/js/fixmystreet.js"></script>
+<script type="text/javascript" src="[% version('/js/fixmystreet.js') %]"></script>
[% map_js %]
diff --git a/templates/web/default/header.html b/templates/web/default/header.html
index cb296da3f..cfe4911a0 100644
--- a/templates/web/default/header.html
+++ b/templates/web/default/header.html
@@ -2,8 +2,8 @@
<html lang="[% lang_code %]">
<head>
- <link rel="stylesheet" type="text/css" href="[% css('/css/core.css') %]">
- <link rel="stylesheet" type="text/css" href="[% css('/css/main.css') %]">
+ <link rel="stylesheet" type="text/css" href="[% version('/css/core.css') %]">
+ <link rel="stylesheet" type="text/css" href="[% version('/css/main.css') %]">
<!--[if LT IE 7]>
<link rel="stylesheet" type="text/css" href="/css/ie6.css">
<![endif]-->
diff --git a/templates/web/default/maps/bing.html b/templates/web/default/maps/bing.html
index 6b7114199..277886cdb 100644
--- a/templates/web/default/maps/bing.html
+++ b/templates/web/default/maps/bing.html
@@ -1,6 +1,6 @@
[% map_js = BLOCK %]
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-GB"></script>
-<script type="text/javascript" src="/js/map-bing.js"></script>
+<script type="text/javascript" src="[% version('/js/map-bing.js') %]"></script>
[% END %]
[% map_html = BLOCK %]
diff --git a/templates/web/default/maps/fms.html b/templates/web/default/maps/fms.html
index 2b322849b..956a22e69 100644
--- a/templates/web/default/maps/fms.html
+++ b/templates/web/default/maps/fms.html
@@ -1,9 +1,9 @@
[% map_js = BLOCK %]
<!-- <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-GB"></script> -->
-<script type="text/javascript" src="/js/OpenLayers.fixmystreet.js"></script>
-<script type="text/javascript" src="/js/map-OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-bing-ol.js"></script>
-<script type="text/javascript" src="/js/jquery.ba-hashchange.min.js"></script>
+<script type="text/javascript" src="[% version('/js/OpenLayers.fixmystreet.js') %]"></script>
+<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script>
+<script type="text/javascript" src="[% version('/js/map-bing-ol.js') %]"></script>
+<script type="text/javascript" src="[% version('/js/jquery.ba-hashchange.min.js') %]"></script>
<!--[if lte IE 6]>
<link rel="stylesheet" href="/jslib/OpenLayers-2.10/theme/default/ie6-style.css" type="text/css" />
<![endif]-->
diff --git a/templates/web/default/maps/google.html b/templates/web/default/maps/google.html
index 2e326734b..69020ea81 100644
--- a/templates/web/default/maps/google.html
+++ b/templates/web/default/maps/google.html
@@ -1,6 +1,6 @@
[% map_js = BLOCK %]
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
-<script type="text/javascript" src="/js/map-google.js"></script>
+<script type="text/javascript" src="[% version('/js/map-google.js') %]"></script>
[% END %]
[% map_html = BLOCK %]
diff --git a/templates/web/default/maps/osm-streetview.html b/templates/web/default/maps/osm-streetview.html
index fd889e6ee..3bc4614c6 100644
--- a/templates/web/default/maps/osm-streetview.html
+++ b/templates/web/default/maps/osm-streetview.html
@@ -1,8 +1,8 @@
[% map_js = BLOCK %]
-<script type="text/javascript" src="/js/OpenLayers.fixmystreet.js"></script>
-<script type="text/javascript" src="/js/map-OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-streetview.js"></script>
-<script type="text/javascript" src="/js/jquery.ba-hashchange.min.js"></script>
+<script type="text/javascript" src="[% version('/js/OpenLayers.fixmystreet.js') %]"></script>
+<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script>
+<script type="text/javascript" src="[% version('/js/map-streetview.js') %]"></script>
+<script type="text/javascript" src="[% version('/js/jquery.ba-hashchange.min.js') %]"></script>
<!--[if lte IE 6]>
<link rel="stylesheet" href="/jslib/OpenLayers-2.10/theme/default/ie6-style.css" type="text/css" />
<![endif]-->
diff --git a/templates/web/default/maps/osm.html b/templates/web/default/maps/osm.html
index f583dd227..804710ad1 100644
--- a/templates/web/default/maps/osm.html
+++ b/templates/web/default/maps/osm.html
@@ -1,8 +1,8 @@
[% map_js = BLOCK %]
-<script type="text/javascript" src="/js/OpenLayers.fixmystreet.js"></script>
-<script type="text/javascript" src="/js/map-OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-OpenStreetMap.js"></script>
-<script type="text/javascript" src="/js/jquery.ba-hashchange.min.js"></script>
+<script type="text/javascript" src="[% version('/js/OpenLayers.fixmystreet.js') %]"></script>
+<script type="text/javascript" src="[% version('/js/map-OpenLayers.js') %]"></script>
+<script type="text/javascript" src="[% version('/js/map-OpenStreetMap.js') %]"></script>
+<script type="text/javascript" src="[% version('/js/jquery.ba-hashchange.min.js') %]"></script>
<!--[if lte IE 6]>
<link rel="stylesheet" href="/jslib/OpenLayers-2.10/theme/default/ie6-style.css" type="text/css" />
<![endif]-->
diff --git a/templates/web/emptyhomes/header.html b/templates/web/emptyhomes/header.html
index 4c313f291..25d62db5c 100644
--- a/templates/web/emptyhomes/header.html
+++ b/templates/web/emptyhomes/header.html
@@ -2,7 +2,7 @@
<html lang="[% lang_code %]">
<head>
- <link rel="stylesheet" type="text/css" href="[% css('/css/core.css') %]">
+ <link rel="stylesheet" type="text/css" href="[% version('/css/core.css') %]">
<link rel="stylesheet" type="text/css" href="/cobrands/emptyhomes/css.css">
<!--[if LT IE 7]>
<link rel="stylesheet" type="text/css" href="/css/ie6.css">
diff --git a/templates/web/fiksgatami/header.html b/templates/web/fiksgatami/header.html
index 6950d0eab..0e78bfc43 100644
--- a/templates/web/fiksgatami/header.html
+++ b/templates/web/fiksgatami/header.html
@@ -2,8 +2,8 @@
<html lang="[% lang_code %]">
<head>
- <link rel="stylesheet" type="text/css" href="[% css('/css/core.css') %]">
- <link rel="stylesheet" type="text/css" href="[% css('/cobrands/fiksgatami/css.css') %]">
+ <link rel="stylesheet" type="text/css" href="[% version('/css/core.css') %]">
+ <link rel="stylesheet" type="text/css" href="[% version('/cobrands/fiksgatami/css.css') %]">
[% INCLUDE 'common_header_tags.html' %]
</head>
diff --git a/templates/web/lichfielddc/header.html b/templates/web/lichfielddc/header.html
index 8d8475c7a..e17e22b9d 100644
--- a/templates/web/lichfielddc/header.html
+++ b/templates/web/lichfielddc/header.html
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="[% lang_code %]">
<head>
- <link rel="stylesheet" type="text/css" href="[% css('/css/core.css') %]">
+ <link rel="stylesheet" type="text/css" href="[% version('/css/core.css') %]">
<link rel="stylesheet" type="text/css" href="/cobrands/lichfielddc/css/layout.css" />
<link rel="stylesheet" type="text/css" href="http://www.lichfielddc.gov.uk/site/styles/standard_1_.css" media="screen" />
diff --git a/templates/web/southampton/header.html b/templates/web/southampton/header.html
index cc97b5ef6..648027d8c 100644
--- a/templates/web/southampton/header.html
+++ b/templates/web/southampton/header.html
@@ -1,12 +1,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <link rel="stylesheet" type="text/css" href="[% css('/css/core.css') %]">
+ <link rel="stylesheet" type="text/css" href="[% version('/css/core.css') %]">
<link rel="stylesheet" type="text/css" href="/cobrands/southampton/style.css" />
- <link rel="stylesheet" type="text/css" href="[% css('/cobrands/southampton/css.css') %]" />
+ <link rel="stylesheet" type="text/css" href="[% version('/cobrands/southampton/css.css') %]" />
[% INCLUDE 'common_header_tags.html' %]
- <script type="text/javascript" src="/js/southampton.js"></script>
+ <script type="text/javascript" src="[% version('/js/southampton.js') %]"></script>
</head>
<body>