diff --git a/Gemfile.lock b/Gemfile.lock index f385792e..dbcf72c8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - compass (0.11.beta.3.01b9cd3) + compass (0.11.beta.3.a9b6d8c) chunky_png (~> 1.1.0) sass (>= 3.1.0.alpha.249) diff --git a/lib/compass/sass_extensions/sprites/base.rb b/lib/compass/sass_extensions/sprites/base.rb index a2e16f75..abf91652 100644 --- a/lib/compass/sass_extensions/sprites/base.rb +++ b/lib/compass/sass_extensions/sprites/base.rb @@ -55,6 +55,7 @@ module Compass image end end + # Calculates the overal image dimensions # collects image sizes and input parameters for each sprite def compute_image_positions! diff --git a/lib/compass/sass_extensions/sprites/image.rb b/lib/compass/sass_extensions/sprites/image.rb index 07c8cfdd..fce68ad0 100644 --- a/lib/compass/sass_extensions/sprites/image.rb +++ b/lib/compass/sass_extensions/sprites/image.rb @@ -51,6 +51,10 @@ module Compass Digest::MD5.file(file).hexdigest end + def mtime + File.mtime(file) + end + private def dimensions @dimensions ||= Compass::SassExtensions::Functions::ImageSize::ImageProperties.new(file).size diff --git a/spec/sprites_spec.rb b/spec/sprites_spec.rb index 94349518..0c8fd94c 100644 --- a/spec/sprites_spec.rb +++ b/spec/sprites_spec.rb @@ -440,5 +440,32 @@ describe Compass::Sprites do } CSS end + + it "should calculate corret sprite demsions when givin spacing via issue#253" do + css = render <<-SCSS + $squares-spacing: 10px; + @import "squares/*.png"; + .foo { + @include sprite-background-position($squares-sprites, "twenty-by-twenty"); + } + .bar { + @include sprite-background-position($squares-sprites, "ten-by-ten"); + } + SCSS + image_size('squares-*.png').should == [20, 40] + css.should == <<-CSS + .squares-sprite { + background: url('/squares-e3c68372d9.png') no-repeat; + } + + .foo { + background-position: 0 -20px; + } + + .bar { + background-position: 0 0; + } + CSS + end end \ No newline at end of file