Permalink
Browse files

update_styles() function added that copies any changed .css from your…

… source/templates directory into the webroot.
  • Loading branch information...
1 parent bd2f3bb commit a2438e81257d058ed1dd7ee8fda748701ef8a463 Sander van Dragt committed Mar 29, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 engine/Updater.php
View
@@ -356,6 +356,22 @@ public static function update_drafts()
}
}
}
+
+ public static function update_styles()
+ {
+ foreach (self::changed_files_in_directory(self::$source_path . '/templates') as $filename => $info) {
+ $file_info = pathinfo($filename);
+ if ($file_info['extension'] != 'css') continue;
+
+ error_log("Changed style file: $filename");
+ $uri = substring_after($filename, self::$source_path . '/templates');
+ $dest_filename = self::$dest_path . $uri;
+ $output_path = dirname($dest_filename);
+ if (! file_exists($output_path)) mkdir_as_parent_owner($output_path, 0755, true);
+ copy($filename, $dest_filename);
+ self::$changes_were_written = true;
+ }
+ }
public static function post_hooks($post)
{
@@ -427,6 +443,7 @@ private static function _update($restart_if_resequenced = true)
self::update_pages();
self::update_drafts();
+ self::update_styles();
foreach (self::changed_files_in_directory(self::$source_path . '/media') as $filename => $info) {
error_log("Changed media file: $filename");

0 comments on commit a2438e8

Please sign in to comment.