From 35b9b60c7c0d618c0d21456955cdb7481a49dc8d Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Mon, 12 Sep 2011 20:44:12 -0400 Subject: [PATCH] Sprite importer now passes the correct filename to the sass engine which was causeing unexpected uris to get returned This fixes the 'to_tree' error that wasn't really a sass bug it was an error on the sprite importers part --- lib/compass/sprite_importer.rb | 8 ++++---- test/units/sprites/importer_test.rb | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/compass/sprite_importer.rb b/lib/compass/sprite_importer.rb index e2a775d2..589f36e5 100644 --- a/lib/compass/sprite_importer.rb +++ b/lib/compass/sprite_importer.rb @@ -19,7 +19,7 @@ module Compass end def find_relative(uri, base, options) - find(File.join(base, uri), options) + nil end def to_s @@ -85,13 +85,13 @@ module Compass end # Returns the sass_options for this sprite - def self.sass_options(name, importer, options) - options.merge!(:filename => name, :syntax => :scss, :importer => importer) + def self.sass_options(uri, importer, options) + options.merge!(:filename => uri, :syntax => :scss, :importer => importer) end # Returns a Sass::Engine for this sprite object def self.sass_engine(uri, name, importer, options) - Sass::Engine.new(content_for_images(uri, name, options[:skip_overrides]), sass_options(name, importer, options)) + Sass::Engine.new(content_for_images(uri, name, options[:skip_overrides]), sass_options(uri, importer, options)) end # Generates the Sass for this sprite file diff --git a/test/units/sprites/importer_test.rb b/test/units/sprites/importer_test.rb index a726a413..e4030017 100644 --- a/test/units/sprites/importer_test.rb +++ b/test/units/sprites/importer_test.rb @@ -68,6 +68,12 @@ class ImporterTest < Test::Unit::TestCase assert_equal 'bar', opts[:foo] end + test "verify that the sass_engine passes the correct filename" do + importer = Compass::SpriteImporter.new + engine = Compass::SpriteImporter.sass_engine(URI, 'foo', importer, options) + assert_equal engine.options[:filename], URI + end + test "should fail given bad sprite extensions" do @images_src_path = File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'sprites', 'public', 'images') file = StringIO.new("images_path = #{@images_src_path.inspect}\n")