This commit is contained in:
Scott Davis 2011-03-21 17:29:15 -04:00
commit a4d43192c9
3 changed files with 8 additions and 146 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ doc-src/.bundle
attic attic
devbin devbin
.rvmrc .rvmrc
*.rbc

View File

@ -1,135 +0,0 @@
PATH
remote: .
specs:
<<<<<<< HEAD
compass (0.11.beta.2.a486129)
=======
compass (0.11.beta.2.0d29379)
>>>>>>> 51e21b08b957a7156235dfdb93c40122873d68e0
chunky_png (~> 0.12.0)
sass (>= 3.1.0.alpha.249)
GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.3)
actionpack (= 3.0.3)
mail (~> 2.2.9)
actionpack (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
rack-test (~> 0.5.6)
tzinfo (~> 0.3.23)
activemodel (3.0.3)
activesupport (= 3.0.3)
builder (~> 2.1.2)
i18n (~> 0.4)
activerecord (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.3)
activemodel (= 3.0.3)
activesupport (= 3.0.3)
activesupport (3.0.3)
addressable (2.2.2)
arel (2.0.6)
builder (2.1.2)
chunky_png (0.12.0)
compass-validator (3.0.0)
css_parser (1.0.1)
cucumber (0.9.4)
builder (~> 2.1.2)
diff-lcs (~> 1.1.2)
gherkin (~> 2.2.9)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
diff-lcs (1.1.2)
em-dir-watcher (0.9.4)
em-websocket (0.1.4)
addressable (>= 2.1.1)
eventmachine (>= 0.12.9)
erubis (2.6.6)
abstract (>= 1.0.0)
eventmachine (0.12.10)
gherkin (2.2.9)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
haml (3.1.0.alpha.36)
i18n (0.5.0)
json (1.4.6)
livereload (1.4)
em-dir-watcher (>= 0.1)
em-websocket (>= 0.1.2)
ruby-json (>= 1.1.2)
mail (2.2.12)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack (>= 1.0.0)
rack-test (0.5.6)
rack (>= 1.0)
rails (3.0.3)
actionmailer (= 3.0.3)
actionpack (= 3.0.3)
activerecord (= 3.0.3)
activeresource (= 3.0.3)
activesupport (= 3.0.3)
bundler (~> 1.0)
railties (= 3.0.3)
railties (3.0.3)
actionpack (= 3.0.3)
activesupport (= 3.0.3)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
rcov (0.9.9)
rspec (2.0.1)
rspec-core (~> 2.0.1)
rspec-expectations (~> 2.0.1)
rspec-mocks (~> 2.0.1)
rspec-core (2.0.1)
rspec-expectations (2.0.1)
diff-lcs (>= 1.1.2)
rspec-mocks (2.0.1)
rspec-core (~> 2.0.1)
rspec-expectations (~> 2.0.1)
ruby-json (1.1.2)
ruby-prof (0.9.2)
rubyzip (0.9.4)
sass (3.1.0.alpha.249)
term-ansicolor (1.0.5)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.23)
PLATFORMS
ruby
DEPENDENCIES
chunky_png (~> 0.12.0)
compass!
compass-validator (= 3.0.0)
css_parser (~> 1.0.1)
cucumber (~> 0.9.2)
haml (~> 3.1.0.alpha)
livereload
rails (~> 3.0.0.rc)
rcov
rspec (~> 2.0.0)
ruby-prof
rubyzip
sass (= 3.1.0.alpha.249)

View File

@ -13,11 +13,7 @@ module Compass::SassExtensions::Functions::Sprites
end end
end end
class SpriteMap < Compass::SassExtensions::Sprites::Base # Creates a Compass::SassExtensions::Sprites::Base object. A sprite map, when used in a property is the same
end
# Creates a SpriteMap object. A sprite map, when used in a property is the same
# as calling sprite-url. So the following background properties are equivalent: # as calling sprite-url. So the following background properties are equivalent:
# #
# $icons: sprite-map("icons/*.png"); # $icons: sprite-map("icons/*.png");
@ -28,7 +24,7 @@ module Compass::SassExtensions::Functions::Sprites
# the first time it is converted to a url. Simply constructing it has no side-effects. # the first time it is converted to a url. Simply constructing it has no side-effects.
def sprite_map(glob, kwargs = {}) def sprite_map(glob, kwargs = {})
kwargs.extend VariableReader kwargs.extend VariableReader
SpriteMap.from_uri(glob, self, kwargs) Compass::SassExtensions::Sprites::Base.from_uri(glob, self, kwargs)
end end
Sass::Script::Functions.declare :sprite_map, [:glob], :var_kwargs => true Sass::Script::Functions.declare :sprite_map, [:glob], :var_kwargs => true
@ -41,7 +37,7 @@ module Compass::SassExtensions::Functions::Sprites
# #
# background: url('/images/icons.png?12345678') 0 -24px no-repeat; # background: url('/images/icons.png?12345678') 0 -24px no-repeat;
def sprite(map, sprite, offset_x = ZERO, offset_y = ZERO) def sprite(map, sprite, offset_x = ZERO, offset_y = ZERO)
unless map.is_a?(SpriteMap) unless map.is_a?(Compass::SassExtensions::Sprites::Base)
missing_sprite!("sprite") missing_sprite!("sprite")
end end
unless sprite.is_a?(Sass::Script::String) unless sprite.is_a?(Sass::Script::String)
@ -58,7 +54,7 @@ module Compass::SassExtensions::Functions::Sprites
# Returns the name of a sprite map # Returns the name of a sprite map
# The name is derived from the folder than contains the sprites. # The name is derived from the folder than contains the sprites.
def sprite_map_name(map) def sprite_map_name(map)
unless map.is_a?(SpriteMap) unless map.is_a?(Compass::SassExtensions::Sprites::Base)
missing_sprite!("sprite-map-name") missing_sprite!("sprite-map-name")
end end
Sass::Script::String.new(map.name) Sass::Script::String.new(map.name)
@ -67,7 +63,7 @@ module Compass::SassExtensions::Functions::Sprites
# Returns the path to the original image file for the sprite with the given name # Returns the path to the original image file for the sprite with the given name
def sprite_file(map, sprite) def sprite_file(map, sprite)
unless map.is_a?(SpriteMap) unless map.is_a?(Compass::SassExtensions::Sprites::Base)
missing_sprite!("sprite-file") missing_sprite!("sprite-file")
end end
if image = map.image_for(sprite.value) if image = map.image_for(sprite.value)
@ -80,7 +76,7 @@ module Compass::SassExtensions::Functions::Sprites
# Returns a url to the sprite image. # Returns a url to the sprite image.
def sprite_url(map) def sprite_url(map)
unless map.is_a?(SpriteMap) unless map.is_a?(Compass::SassExtensions::Sprites::Base)
missing_sprite!("sprite-url") missing_sprite!("sprite-url")
end end
map.generate map.generate
@ -110,7 +106,7 @@ module Compass::SassExtensions::Functions::Sprites
# #
# background-position: 3px -36px; # background-position: 3px -36px;
def sprite_position(map, sprite = nil, offset_x = ZERO, offset_y = ZERO) def sprite_position(map, sprite = nil, offset_x = ZERO, offset_y = ZERO)
unless map.is_a?(SpriteMap) unless map.is_a?(Compass::SassExtensions::Sprites::Base)
missing_sprite!("sprite-position") missing_sprite!("sprite-position")
end end
unless sprite && sprite.is_a?(Sass::Script::String) unless sprite && sprite.is_a?(Sass::Script::String)