Rename the sprite Base class to SpriteMap
This commit is contained in:
parent
c73d281e58
commit
008cffa3ef
@ -10,7 +10,7 @@ module Compass::SassExtensions::Functions::Sprites
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Creates a Compass::SassExtensions::Sprites::Base object. A sprite map, when used in a property is the same
|
# Creates a Compass::SassExtensions::Sprites::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");
|
||||||
@ -21,7 +21,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
|
||||||
Compass::SassExtensions::Sprites::Base.from_uri(glob, self, kwargs)
|
Compass::SassExtensions::Sprites::SpriteMap.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
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ protected
|
|||||||
end
|
end
|
||||||
|
|
||||||
def verify_map(map, error = "sprite")
|
def verify_map(map, error = "sprite")
|
||||||
unless map.is_a?(Compass::SassExtensions::Sprites::Base)
|
unless map.is_a?(Compass::SassExtensions::Sprites::SpriteMap)
|
||||||
missing_sprite!(error)
|
missing_sprite!(error)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
require 'digest/md5'
|
require 'digest/md5'
|
||||||
require 'compass/sprite_importer'
|
require 'compass/sprite_importer'
|
||||||
require 'compass/sass_extensions/sprites/image'
|
|
||||||
require 'compass/sass_extensions/sprites/base'
|
|
||||||
require 'compass/sass_extensions/sprites/engines'
|
|
||||||
|
|
||||||
module Compass
|
module Compass
|
||||||
module SassExtensions
|
module SassExtensions
|
||||||
module Sprites
|
module Sprites
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require 'compass/sass_extensions/sprites/image'
|
||||||
|
require 'compass/sass_extensions/sprites/sprite_map'
|
||||||
|
require 'compass/sass_extensions/sprites/engines'
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
module Compass
|
module Compass
|
||||||
module SassExtensions
|
module SassExtensions
|
||||||
module Sprites
|
module Sprites
|
||||||
class Base < Sass::Script::Literal
|
class SpriteMap < Sass::Script::Literal
|
||||||
|
|
||||||
|
|
||||||
# Initialize a new sprite object from a relative file path
|
# Initialize a new sprite object from a relative file path
|
@ -20,7 +20,7 @@ class SpritesImageTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
def parent
|
def parent
|
||||||
importer = Compass::SpriteImporter.new(:uri => "selectors/*.png", :options => options)
|
importer = Compass::SpriteImporter.new(:uri => "selectors/*.png", :options => options)
|
||||||
@parent ||= Compass::SassExtensions::Sprites::Base.new(importer.sprite_names.map{|n| "selectors/#{n}.png"}, importer.path, importer.name, importer.sass_engine, importer.options)
|
@parent ||= Compass::SassExtensions::Sprites::SpriteMap.new(importer.sprite_names.map{|n| "selectors/#{n}.png"}, importer.path, importer.name, importer.sass_engine, importer.options)
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:options) do
|
let(:options) do
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class SpritesBaseTest < Test::Unit::TestCase
|
class SpriteMapTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
Hash.send(:include, Compass::SassExtensions::Functions::Sprites::VariableReader)
|
Hash.send(:include, Compass::SassExtensions::Functions::Sprites::VariableReader)
|
||||||
@ -17,7 +17,7 @@ class SpritesBaseTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
def setup_map
|
def setup_map
|
||||||
@importer = Compass::SpriteImporter.new(:uri => "selectors/*.png", :options => @options)
|
@importer = Compass::SpriteImporter.new(:uri => "selectors/*.png", :options => @options)
|
||||||
@base = Compass::SassExtensions::Sprites::Base.new(@importer.sprite_names.map{|n| "selectors/#{n}.png"}, @importer.path, @importer.name, @importer.sass_engine, @importer.options)
|
@base = Compass::SassExtensions::Sprites::SpriteMap.new(@importer.sprite_names.map{|n| "selectors/#{n}.png"}, @importer.path, @importer.name, @importer.sass_engine, @importer.options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
Loading…
Reference in New Issue
Block a user