Skip to content

Commit

Permalink
New APIs for dealing with configuration changes and accessing a compi…
Browse files Browse the repository at this point in the history
…ler instance.
  • Loading branch information
chriseppstein committed Feb 14, 2010
1 parent d59451f commit c1b9030
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/compass.rb
Expand Up @@ -17,6 +17,6 @@ def lib_directory
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
7 changes: 7 additions & 0 deletions lib/compass/compiler.rb
Expand Up @@ -58,6 +58,13 @@ def new_config?
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.
Expand Down
2 changes: 1 addition & 1 deletion lib/compass/configuration/adapters.rb
Expand Up @@ -3,7 +3,7 @@ module Configuration
# 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

Expand Down
9 changes: 9 additions & 0 deletions lib/compass/configuration/helpers.rb
Expand Up @@ -112,6 +112,15 @@ def detect_configuration_file(project_path = nil)
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

Expand Down

0 comments on commit c1b9030

Please sign in to comment.