From 56b48d5e33d20955ddc41b63d1faf04d9ab51759 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 21 Jan 2015 14:56:56 +0000 Subject: [PATCH] Allow cache subversion for css files as well as js files. --- Webperl/Template.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Webperl/Template.pm b/Webperl/Template.pm index b30625e..b7f67da 100644 --- a/Webperl/Template.pm +++ b/Webperl/Template.pm @@ -357,12 +357,15 @@ sub set_template_dir { $self -> {"templatepath"} = path_join($self -> {"scriptpath"}, $self -> {"basedir"}, $self -> {"theme"}); $self -> {"templatepath"} .= "/" unless($self -> {"templatepath"} =~ m|/$|); # templatepath must have trailing slash - # work out the javascript path - my $jsdir = "js"; - $jsdir .= "_".$self -> {"settings"} -> {"config"} -> {"jsdirid"} if($self -> {"settings"} -> {"config"} -> {"jsdirid"}); - $self -> {"jspath"} = path_join($self -> {"templatepath"}, $jsdir); + # work out the javascript and css paths + my $dirid = $self -> {"settings"} -> {"config"} -> {"jsdirid"} ? "_".$self -> {"settings"} -> {"config"} -> {"jsdirid"} : ""; + + $self -> {"jspath"} = path_join($self -> {"templatepath"}, "js".$dirid); $self -> {"jspath"} .= "/" unless($self -> {"jspath"} =~ m|/$|); # jspath must have trailing slash + $self -> {"csspath"} = path_join($self -> {"templatepath"}, "css".$dirid); + $self -> {"csspath"} .= "/" unless($self -> {"csspath"} =~ m|/$|); # csspath must have trailing slash + # The URL... $self -> {"templateurl"} = path_join($self -> {"cgi"} -> url(-base => 1), $self -> {"templatepath"})."/" if($self -> {"cgi"}); @@ -560,6 +563,7 @@ sub fix_variables { $$textref =~ s/{V_\[templatepath\]}/$self->{templatepath}/g; $$textref =~ s/{V_\[templateurl\]}/$self->{templateurl}/g; $$textref =~ s/{V_\[jspath\]}/$self->{jspath}/g; + $$textref =~ s/{V_\[csspath\]}/$self->{csspath}/g; $$textref =~ s/{V_\[commonpath\]}/$self->{commonpath}/g; $$textref =~ s/{V_\[sitename\]}/$self->{settings}->{config}->{site_name}/g; $$textref =~ s/{V_\[admin_email\]}/$email/g;