New APIs for dealing with configuration changes and accessing a compiler instance.
This commit is contained in:
parent
d59451f398
commit
c1b903024f
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user