patched image functions to accept a real path
This commit is contained in:
parent
ec7c4b2e9c
commit
289c452d64
@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
compass (0.12.0.alpha.0.8c48248)
|
||||
compass (0.12.0.alpha.0.ec7c4b2)
|
||||
chunky_png (~> 1.2)
|
||||
fssm (>= 0.2.7)
|
||||
sass (~> 3.1)
|
||||
|
@ -1,14 +1,22 @@
|
||||
module Compass::SassExtensions::Functions::ImageSize
|
||||
# Returns the width of the image relative to the images directory
|
||||
def image_width(image_file)
|
||||
image_path = real_path(image_file)
|
||||
image_path = if File.exists?(image_file.value)
|
||||
image_file.value
|
||||
else
|
||||
real_path(image_file)
|
||||
end
|
||||
width = ImageProperties.new(image_path).size.first
|
||||
Sass::Script::Number.new(width,["px"])
|
||||
end
|
||||
|
||||
# Returns the height of the image relative to the images directory
|
||||
def image_height(image_file)
|
||||
image_path = real_path(image_file)
|
||||
image_path = if File.exists?(image_file.value)
|
||||
image_file.value
|
||||
else
|
||||
real_path(image_file)
|
||||
end
|
||||
height = ImageProperties.new(image_path).size.last
|
||||
Sass::Script::Number.new(height, ["px"])
|
||||
end
|
||||
|
@ -61,7 +61,7 @@ module Compass::SassExtensions::Functions::Sprites
|
||||
verify_map(map, "sprite")
|
||||
verify_sprite(sprite)
|
||||
if image = map.image_for(sprite.value)
|
||||
Sass::Script::String.new(image.relative_file)
|
||||
Sass::Script::String.new(image.file)
|
||||
else
|
||||
missing_image!(map, sprite)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user