From 9432e96964057ac24577371442dd84e7692578ce Mon Sep 17 00:00:00 2001
From: Drave Robber <DraveRobber@984338.no-reply.drupal.org>
Date: Sun, 26 Aug 2012 14:38:53 +0300
Subject: [PATCH] Only re-write font.css when CSS changes

---
 fontyourface.install |    1 +
 fontyourface.module  |    9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/fontyourface.install b/fontyourface.install
index a708bdd..378fd84 100644
--- a/fontyourface.install
+++ b/fontyourface.install
@@ -20,6 +20,7 @@ function fontyourface_install() {
 function fontyourface_uninstall() {
 
   drupal_uninstall_schema('fontyourface');
+  variable_del('fontyourface_css_md5');
 
 } // fontyourface_uninstall
 
diff --git a/fontyourface.module b/fontyourface.module
index e2c88c2..eea26ba 100644
--- a/fontyourface.module
+++ b/fontyourface.module
@@ -525,7 +525,14 @@ function fontyourface_preprocess_page(&$vars) {
 
     } // foreach
 
-    file_save_data($css, $destination, FILE_EXISTS_REPLACE);
+    $css_md5 = md5($css);
+
+    if ($css_md5 != variable_get('fontyourface_css_md5', '')) {
+
+      file_save_data($css, $destination, FILE_EXISTS_REPLACE);
+      variable_set('fontyourface_css_md5', $css_md5);
+
+    } // if
 
   } // if
 
-- 
1.7.4.1

