New APIs for dealing with configuration changes and accessing a compiler instance.

This commit is contained in:
Chris Eppstein 2010-02-13 16:56:53 -08:00
parent d59451f398
commit c1b903024f
4 changed files with 18 additions and 2 deletions

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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