diff --git a/lib/compass/sprites.rb b/lib/compass/sprites.rb index 5a649c2c..8b8b66c5 100644 --- a/lib/compass/sprites.rb +++ b/lib/compass/sprites.rb @@ -25,10 +25,10 @@ module Compass Compass::Sprites.sprites(self.name) end - def find(url, context = nil) - if url =~ /\.png$/ - path, self.name = Compass::Sprites.path_and_name(url) - glob = File.join(Compass.configuration.images_path, url) + def find(uri, options) + if uri =~ /\.png$/ + path, self.name = Compass::Sprites.path_and_name(uri) + glob = File.join(Compass.configuration.images_path, uri) generated_image = "#{path}.png" y = 0 Dir.glob(glob).sort.each do |file| @@ -74,17 +74,14 @@ module Compass end.join} } SCSS - Sass::Engine.new(contents, :filename => name, :syntax => :scss, :importer => self) + options.merge! :filename => name, :syntax => :scss, :importer => self + Sass::Engine.new(contents, options) end end - def key(name, options) - [self.class.name + ":" + File.dirname(File.expand_path(name)), - File.basename(name)] - end - - def to_s - "fdsfd" + def key(uri, options) + [self.class.name + ":" + File.dirname(File.expand_path(uri)), + File.basename(uri)] end end diff --git a/spec/sprites_spec.rb b/spec/sprites_spec.rb index 1183fd05..640e6f87 100644 --- a/spec/sprites_spec.rb +++ b/spec/sprites_spec.rb @@ -28,13 +28,16 @@ describe Compass::Sprites do SCSS css.should == <<-CSS .squares-sprite, .squares-10x10, .squares-20x20 { - background: url('/squares.png') no-repeat; } + background: url('/squares.png') no-repeat; + } .squares-10x10 { - background-position: 0 0; } + background-position: 0 0; + } .squares-20x20 { - background-position: 0 -10px; } + background-position: 0 -10px; + } CSS end @@ -46,17 +49,20 @@ describe Compass::Sprites do SCSS css.should == <<-CSS .squares-sprite, .squares-10x10, .squares-20x20 { - background: url('/squares.png') no-repeat; } + background: url('/squares.png') no-repeat; + } .squares-10x10 { background-position: 0 0; height: 10px; - width: 10px; } + width: 10px; + } .squares-20x20 { background-position: 0 -10px; height: 20px; - width: 20px; } + width: 20px; + } CSS end @@ -74,7 +80,8 @@ describe Compass::Sprites do SCSS css.should == <<-CSS .squares-sprite, .cubicle, .large-cube { - background: url('/squares.png') no-repeat; } + background: url('/squares.png') no-repeat; + } .cubicle { background-position: 0 0; @@ -95,7 +102,8 @@ describe Compass::Sprites do SCSS css.should == <<-CSS .circles { - background: url('/squares.png') no-repeat; } + background: url('/squares.png') no-repeat; + } CSS end