diff --git a/lib/compass.rb b/lib/compass.rb index aeae12dd..3566fb94 100644 --- a/lib/compass.rb +++ b/lib/compass.rb @@ -17,6 +17,6 @@ module Compass module_function :base_directory, :lib_directory end -%w(configuration frameworks app_integration).each do |lib| +%w(configuration frameworks app_integration actions compiler).each do |lib| require "compass/#{lib}" end diff --git a/lib/compass/compiler.rb b/lib/compass/compiler.rb index 2c626439..ed33b808 100644 --- a/lib/compass/compiler.rb +++ b/lib/compass/compiler.rb @@ -58,6 +58,13 @@ module Compass nil end + def clean! + FileUtils.rm_rf options[:cache_location] + css_files.each do |css_file| + FileUtils.rm_f css_file + end + end + def run if new_config? # Wipe out the cache and force compilation if the configuration has changed. diff --git a/lib/compass/configuration/adapters.rb b/lib/compass/configuration/adapters.rb index 98fb8be4..0be86dc3 100644 --- a/lib/compass/configuration/adapters.rb +++ b/lib/compass/configuration/adapters.rb @@ -3,7 +3,7 @@ module Compass # The adapters module provides methods that make configuration data from a compass project # adapt to various consumers of configuration data module Adapters - def to_compiler_arguments(additional_options) + def to_compiler_arguments(additional_options = {}) [project_path, sass_path, css_path, to_sass_engine_options.merge(additional_options)] end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index d1d983bb..643523fa 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -112,6 +112,15 @@ module Compass possible_files.detect{|f| File.exists?(f)} end + def handle_configuration_change! + if (compiler = Compass.compiler).new_config? + compiler.clean! + end + end + + def compiler + Compass::Compiler.new(*Compass.configuration.to_compiler_arguments) + end end end