Fix a bug in sprite-location resolution
This commit is contained in:
parent
00b41b5506
commit
bcf1f4b1f6
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user