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
|
module_function :base_directory, :lib_directory
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(configuration frameworks app_integration).each do |lib|
|
%w(configuration frameworks app_integration actions compiler).each do |lib|
|
||||||
require "compass/#{lib}"
|
require "compass/#{lib}"
|
||||||
end
|
end
|
||||||
|
@ -58,6 +58,13 @@ module Compass
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def clean!
|
||||||
|
FileUtils.rm_rf options[:cache_location]
|
||||||
|
css_files.each do |css_file|
|
||||||
|
FileUtils.rm_f css_file
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
if new_config?
|
if new_config?
|
||||||
# Wipe out the cache and force compilation if the configuration has changed.
|
# 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
|
# The adapters module provides methods that make configuration data from a compass project
|
||||||
# adapt to various consumers of configuration data
|
# adapt to various consumers of configuration data
|
||||||
module Adapters
|
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)]
|
[project_path, sass_path, css_path, to_sass_engine_options.merge(additional_options)]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -112,6 +112,15 @@ module Compass
|
|||||||
possible_files.detect{|f| File.exists?(f)}
|
possible_files.detect{|f| File.exists?(f)}
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user