optimized options

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

View File

@ -25,10 +25,10 @@ module Compass
Compass::Sprites.sprites(self.name) Compass::Sprites.sprites(self.name)
end end
def find(url, context = nil) def find(uri, options)
if url =~ /\.png$/ if uri =~ /\.png$/
path, self.name = Compass::Sprites.path_and_name(url) path, self.name = Compass::Sprites.path_and_name(uri)
glob = File.join(Compass.configuration.images_path, url) glob = File.join(Compass.configuration.images_path, uri)
generated_image = "#{path}.png" generated_image = "#{path}.png"
y = 0 y = 0
Dir.glob(glob).sort.each do |file| Dir.glob(glob).sort.each do |file|
@ -74,17 +74,14 @@ module Compass
end.join} end.join}
} }
SCSS 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
end end
def key(name, options) def key(uri, options)
[self.class.name + ":" + File.dirname(File.expand_path(name)), [self.class.name + ":" + File.dirname(File.expand_path(uri)),
File.basename(name)] File.basename(uri)]
end
def to_s
"fdsfd"
end end
end end

View File

@ -28,13 +28,16 @@ describe Compass::Sprites do
SCSS SCSS
css.should == <<-CSS css.should == <<-CSS
.squares-sprite, .squares-10x10, .squares-20x20 { .squares-sprite, .squares-10x10, .squares-20x20 {
background: url('/squares.png') no-repeat; } background: url('/squares.png') no-repeat;
}
.squares-10x10 { .squares-10x10 {
background-position: 0 0; } background-position: 0 0;
}
.squares-20x20 { .squares-20x20 {
background-position: 0 -10px; } background-position: 0 -10px;
}
CSS CSS
end end
@ -46,17 +49,20 @@ describe Compass::Sprites do
SCSS SCSS
css.should == <<-CSS css.should == <<-CSS
.squares-sprite, .squares-10x10, .squares-20x20 { .squares-sprite, .squares-10x10, .squares-20x20 {
background: url('/squares.png') no-repeat; } background: url('/squares.png') no-repeat;
}
.squares-10x10 { .squares-10x10 {
background-position: 0 0; background-position: 0 0;
height: 10px; height: 10px;
width: 10px; } width: 10px;
}
.squares-20x20 { .squares-20x20 {
background-position: 0 -10px; background-position: 0 -10px;
height: 20px; height: 20px;
width: 20px; } width: 20px;
}
CSS CSS
end end
@ -74,7 +80,8 @@ describe Compass::Sprites do
SCSS SCSS
css.should == <<-CSS css.should == <<-CSS
.squares-sprite, .cubicle, .large-cube { .squares-sprite, .cubicle, .large-cube {
background: url('/squares.png') no-repeat; } background: url('/squares.png') no-repeat;
}
.cubicle { .cubicle {
background-position: 0 0; background-position: 0 0;
@ -95,7 +102,8 @@ describe Compass::Sprites do
SCSS SCSS
css.should == <<-CSS css.should == <<-CSS
.circles { .circles {
background: url('/squares.png') no-repeat; } background: url('/squares.png') no-repeat;
}
CSS CSS
end end