diff --git a/lib/compass/configuration/adapters.rb b/lib/compass/configuration/adapters.rb index 215982fd..a139de1f 100644 --- a/lib/compass/configuration/adapters.rb +++ b/lib/compass/configuration/adapters.rb @@ -13,8 +13,13 @@ module Compass Compass::Frameworks::ALL.each do |framework| locations << [framework.stylesheets_directory, File.join(css_path || css_dir || ".", framework.name)] end + load_paths = [] resolve_additional_import_paths.each do |additional_path| - locations << [additional_path, File.join(css_path || css_dir || ".", File.basename(additional_path))] + if additional_path.is_a?(String) + locations << [additional_path, File.join(css_path || css_dir || ".", File.basename(additional_path))] + else + load_paths << additional_path + end end plugin_opts = {:template_location => locations} plugin_opts[:style] = output_style if output_style @@ -23,13 +28,14 @@ module Compass plugin_opts[:cache_location] = cache_path unless cache_path.nil? plugin_opts.merge!(sass_options || {}) plugin_opts[:load_paths] ||= [] + plugin_opts[:load_paths] += load_paths plugin_opts[:load_paths] << Compass::SpriteImporter.new plugin_opts end def resolve_additional_import_paths (additional_import_paths || []).map do |path| - if project_path && !absolute_path?(path) + if path.is_a?(String) && project_path && !absolute_path?(path) File.join(project_path, path) else path diff --git a/test/units/configuration_test.rb b/test/units/configuration_test.rb index c383aec8..623ff8cc 100644 --- a/test/units/configuration_test.rb +++ b/test/units/configuration_test.rb @@ -240,6 +240,21 @@ EXPECTED assert_correct expected_serialization.split("\n"), Compass.configuration.serialize.split("\n") end + def test_additional_import_paths_can_be_importers + contents = StringIO.new(<<-CONFIG) + http_path = "/" + project_path = "/home/chris/my_compass_project" + css_dir = "css" + additional_import_paths = ["../foo"] + add_import_path Sass::Importers::Filesystem.new("/tmp/foo") + CONFIG + + Compass.add_configuration(contents, "test_additional_import_paths") + + assert Compass.configuration.sass_load_paths.find{|p| p.is_a?(Sass::Importers::Filesystem) && p.root == "/tmp/foo"} + assert Compass.configuration.to_sass_plugin_options[:load_paths].find{|p| p.is_a?(Sass::Importers::Filesystem) && p.root == "/tmp/foo"} + end + def test_config_with_pathname contents = StringIO.new(<<-CONFIG) http_path = "/"