From 3bb5e6d83d07044217e86b9e4216c7bbc6d6638d Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Tue, 1 Dec 2009 10:34:29 -0800 Subject: [PATCH] If the configuration file changes, wipe out the sass cache and force compilation. Closes #55. --- lib/compass/compiler.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/compass/compiler.rb b/lib/compass/compiler.rb index 78dc5f9b..eb40b8e4 100644 --- a/lib/compass/compiler.rb +++ b/lib/compass/compiler.rb @@ -42,7 +42,25 @@ module Compass false end + def new_config? + config_file = Compass.detect_configuration_file + return false unless config_file + config_mtime = File.mtime(config_file) + css_files.each do |css_filename| + return config_file if File.exists?(css_filename) && config_mtime > File.mtime(css_filename) + end + nil + end + + def cache_location + Compass.configuration.cache_path || Sass::Plugin.options[:cache_location] || "./.sass-cache" + end + def run + if new_config? + FileUtils.rm_rf cache_location + options[:force] = true + end Compass.configure_sass_plugin! unless Compass.sass_plugin_configured? target_directories.each do |dir| directory dir