changeset 12:9efe0b8729a8

2007-08-14 14:01:15 by steve Copy any static files into place when building the file, not just a single stylesheet.
author steve
date Tue, 14 Aug 2007 14:01:15 +0000
parents 057cd84ce271
children a3d2dca6ada3
files bin/chronicle
diffstat 1 files changed, 25 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/bin/chronicle	Tue Aug 14 13:39:30 2007 +0000
+++ b/bin/chronicle	Tue Aug 14 14:01:15 2007 +0000
@@ -54,7 +54,7 @@
  --
  http://www.steve.org.uk/
 
- $Id: chronicle,v 1.5 2007-08-14 13:39:30 steve Exp $
+ $Id: chronicle,v 1.6 2007-08-14 14:01:15 steve Exp $
 
 =cut
 
@@ -207,9 +207,9 @@
 
 
 #
-#  Copy the stylesheet into place.
+#  Copy any static files into place.
 #
-copyStyleSheet();
+copyStaticFiles();
 
 
 #
@@ -294,7 +294,7 @@
 
     if ( $VERSION )
     {
-        my $REVISION      = '$Revision: 1.5 $';
+        my $REVISION      = '$Revision: 1.6 $';
         if ( $REVISION =~ /1.([0-9.]+) / )
         {
             $REVISION = $1;
@@ -1300,16 +1300,32 @@
 
 =begin doc
 
-  Copy the stylesheet into place unless it already exists.
+  Copy any static files from the theme directory into the "live" location
+ in the output.
+
+  This only works for a top-level target directory.
 
 =end doc
 
 =cut
 
-sub copyStyleSheet
+sub copyStaticFiles
 {
-    my $input  = $CONFIG{'template'} . "/style.css";
-    my $output = $CONFIG{'output'} . "/style.css";
+    #
+    #  Soure and destination for the copy
+    #
+    my $input  = $CONFIG{'template'};
+    my $output = $CONFIG{'output'};
 
-    copy( $input, $output ) unless( -e $output );
+    foreach my $pattern ( qw! *.css *.jpg *.gif *.png *.js *.ico ! )
+    {
+        foreach my $file ( glob( $input . "/" . $pattern ) )
+        {
+            if ( ! -e  "$output/$file" )
+            {
+                $CONFIG{'verbose'} && print "Copying static file $file\n";
+                copy( "$input/$file", "$output/$file" );
+            }
+        }
+    }
 }