added support for sprite-selector formats
This commit is contained in:
parent
4d7dc7ad30
commit
c72eebdf42
@ -7,7 +7,7 @@ GIT
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
compass (0.11.beta.4.9962a37)
|
compass (0.11.beta.4.4d7dc7a)
|
||||||
chunky_png (~> 1.1.0)
|
chunky_png (~> 1.1.0)
|
||||||
sass (>= 3.1.0.alpha.249)
|
sass (>= 3.1.0.alpha.249)
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ GEM
|
|||||||
mocha (0.9.12)
|
mocha (0.9.12)
|
||||||
polyglot (0.3.1)
|
polyglot (0.3.1)
|
||||||
rack (1.2.2)
|
rack (1.2.2)
|
||||||
rack-mount (0.6.13)
|
rack-mount (0.6.14)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
rack-test (0.5.7)
|
rack-test (0.5.7)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
@ -2,6 +2,11 @@ module Compass
|
|||||||
module SassExtensions
|
module SassExtensions
|
||||||
module Sprites
|
module Sprites
|
||||||
class Image
|
class Image
|
||||||
|
ACTIVE = %r{[_-]active$}
|
||||||
|
TARGET = %r{[_-]target$}
|
||||||
|
HOVER = %r{[_-]hover$}
|
||||||
|
PARENT = %r{(.+)_(.+)$}
|
||||||
|
|
||||||
attr_reader :relative_file, :options, :base
|
attr_reader :relative_file, :options, :base
|
||||||
attr_accessor :top, :left
|
attr_accessor :top, :left
|
||||||
|
|
||||||
@ -67,7 +72,7 @@ module Compass
|
|||||||
|
|
||||||
# Has hover selector
|
# Has hover selector
|
||||||
def hover?
|
def hover?
|
||||||
name[-6..-1] == '_hover'
|
name =~ HOVER
|
||||||
end
|
end
|
||||||
|
|
||||||
# Hover selector Image object if exsists
|
# Hover selector Image object if exsists
|
||||||
@ -77,7 +82,7 @@ module Compass
|
|||||||
|
|
||||||
# Has target selector
|
# Has target selector
|
||||||
def target?
|
def target?
|
||||||
name[-7..-1] == '_target'
|
name =~ TARGET
|
||||||
end
|
end
|
||||||
|
|
||||||
# Target selector Image object if exsists
|
# Target selector Image object if exsists
|
||||||
@ -87,7 +92,7 @@ module Compass
|
|||||||
|
|
||||||
# Has active selector
|
# Has active selector
|
||||||
def active?
|
def active?
|
||||||
name[-7..-1] == '_active'
|
name =~ ACTIVE
|
||||||
end
|
end
|
||||||
|
|
||||||
# Active selector Image object if exsists
|
# Active selector Image object if exsists
|
||||||
@ -98,7 +103,7 @@ module Compass
|
|||||||
|
|
||||||
def parent
|
def parent
|
||||||
if [hover?, target?, active?].any?
|
if [hover?, target?, active?].any?
|
||||||
%r{(.+)_(.+)$}.match name
|
PARENT.match name
|
||||||
base.image_for($1)
|
base.image_for($1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user