lib/compass/configuration/helpers.rb in compass-0.12.alpha.2 vs lib/compass/configuration/helpers.rb in compass-0.12.alpha.3
- old
+ new
@@ -65,16 +65,23 @@
unless Sass::Plugin.engine_options[:load_paths].include?(sass_dir)
Sass::Plugin.add_template_location sass_dir, css_dir
end
end
unless @callbacks_loaded
- Sass::Plugin.on_updating_stylesheet do |sass_file, css_file|
- Compass.configuration.run_stylesheet_saved(css_file)
+ on_saved = Proc.new do |sass_file, css_file|
+ Compass.configuration.run_stylesheet_saved(css_file)
+ end
+ if Sass::Plugin.respond_to?(:on_updated_stylesheet)
+ Sass::Plugin.on_updated_stylesheet(&on_saved)
+ else
+ Sass::Plugin.on_updating_stylesheet(&on_saved)
end
+
Sass::Plugin.on_compilation_error do |e, filename, css|
Compass.configuration.run_stylesheet_error(filename, e.message)
end
+
@callbacks_loaded = true
end
end
def configure_rails!(app)
@@ -90,9 +97,19 @@
# Read the configuration file for this project
def add_project_configuration(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
configuration_file_path = args.shift || detect_configuration_file
+
+ # TODO make this better i don't think it belongs here but it gets the job done
+ # This will allow compass to boot rails and load the config if its configured in the application.rb file via railtie
+ # if File.exists?(projectize('config/boot.rb')) && configuration_file_path.nil?
+ # require 'rails'
+ # require projectize('config/application.rb')
+ # options[:project_type] = :rails
+ # end
+
+
raise ArgumentError, "Too many arguments" if args.any?
if data = configuration_for(configuration_file_path, nil, configuration_for(options[:defaults]))
if data.raw_project_type
add_configuration(data.raw_project_type.to_sym)
elsif options[:project_type]