optimized options

This commit is contained in:
Nico Hagenburger 2010-10-15 01:24:14 +02:00 committed by Chris Eppstein
parent 004a1f3887
commit 4026c51273
2 changed files with 25 additions and 20 deletions

View File

@ -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

View File

@ -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