Fix a bug in sprite-location resolution

This commit is contained in:
Chris Eppstein 2010-12-05 16:10:03 -08:00
parent 00b41b5506
commit bcf1f4b1f6

View File

@ -17,7 +17,10 @@ module Compass::SassExtensions::Functions::Sprites
def self.from_uri(uri, context, kwargs) def self.from_uri(uri, context, kwargs)
path, name = Compass::Sprites.path_and_name(uri.value) path, name = Compass::Sprites.path_and_name(uri.value)
new(Compass::Sprites.discover_sprites(uri.value), path, name, context, kwargs) sprites = Compass::Sprites.discover_sprites(uri.value).map do |sprite|
sprite.gsub(Compass.configuration.images_path+"/", "")
end
new(sprites, path, name, context, kwargs)
end end
def initialize(image_names, path, name, context, options) def initialize(image_names, path, name, context, options)
@ -47,8 +50,8 @@ module Compass::SassExtensions::Functions::Sprites
def compute_image_metadata! def compute_image_metadata!
@images = [] @images = []
@width = 0 @width = 0
image_names.each do |file| image_names.each do |relative_file|
relative_file = file.gsub(Compass.configuration.images_path+"/", "") file = File.join(Compass.configuration.images_path, relative_file)
width, height = Compass::SassExtensions::Functions::ImageSize::ImageProperties.new(file).size width, height = Compass::SassExtensions::Functions::ImageSize::ImageProperties.new(file).size
sprite_name = Compass::Sprites.sprite_name(relative_file) sprite_name = Compass::Sprites.sprite_name(relative_file)
@width = [@width, width].max @width = [@width, width].max