adjust spritmap class to usr load path to get relative sprite names

This commit is contained in:
Scott Davis 2011-07-27 02:11:45 -04:00
parent 71494cecfe
commit 0984b48b24
2 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
compass (0.12.0.alpha.0.5e89865) compass (0.12.0.alpha.0.71494ce)
chunky_png (~> 1.2) chunky_png (~> 1.2)
fssm (>= 0.2.7) fssm (>= 0.2.7)
sass (~> 3.1) sass (~> 3.1)

View File

@ -17,10 +17,18 @@ module Compass
name, path = Compass::SpriteImporter.path_and_name(uri) name, path = Compass::SpriteImporter.path_and_name(uri)
files = Compass::SpriteImporter.files(uri) files = Compass::SpriteImporter.files(uri)
sprites = files.map do |sprite| sprites = files.map do |sprite|
sprite.gsub("#{Compass.configuration.images_path}/", "") relative_name(sprite)
end end
new(sprites, path, name, context, kwargs) new(sprites, path, name, context, kwargs)
end end
def self.relative_name(sprite)
Compass.configuration.sprite_load_path.each do |path|
if sprite.include?(path)
return sprite.gsub("#{path}/", "")
end
end
end
def initialize(sprites, path, name, context, kwargs) def initialize(sprites, path, name, context, kwargs)
@image_names = sprites @image_names = sprites