From 45b19df315f9e09552a045961089649806f84b29 Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Sat, 10 Sep 2011 16:42:12 -0400 Subject: [PATCH] cache the image dimensions in sass options --- lib/compass/sass_extensions/functions/image_size.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/compass/sass_extensions/functions/image_size.rb b/lib/compass/sass_extensions/functions/image_size.rb index a2ff7420..65989254 100644 --- a/lib/compass/sass_extensions/functions/image_size.rb +++ b/lib/compass/sass_extensions/functions/image_size.rb @@ -45,7 +45,10 @@ module Compass::SassExtensions::Functions::ImageSize private def image_demensions(image_file) - ImageProperties.new(image_path(image_file.value)).size + options[:custom] ||= {} + options[:custom][:compass] ||= {} + options[:custom][:compass][:image_dimensions] ||= {} + options[:custom][:compass][:image_dimensions][image_file.value] = ImageProperties.new(image_path(image_file.value)).size end def image_path(image_file)