Module | Compass::SassExtensions::Functions::Sprites
In: | lib/compass/sass_extensions/functions/sprites.rb

### Methods

convert_sprite_name missing_image! missing_sprite! sprite sprite_does_not_have_parent sprite_file sprite_has_selector sprite_image sprite_map sprite_map_name sprite_position sprite_url verify_map verify_sprite

### Classes and Modules

Module Compass::SassExtensions::Functions::Sprites::VariableReader

### Constants

ZERO | = | Sass::Script::Number::new(0)
VALID_SELECTORS | = | %w(hover active target)

### Public Instance methods

sprite(map, sprite, offset_x = ZERO, offset_y = ZERO)

Returns the image and background position for use in a single shorthand property:

        $icons: sprite-map("icons/*.png"); // contains icons/new.png among others.
        background: sprite($icons, new) no-repeat;

Becomes:

        background: url('/images/icons.png?12345678') 0 -24px no-repeat;

sprite_does_not_have_parent(map, sprite)

Returns voolean if sprite has a parent

sprite_file(map, sprite)

Returns the path to the original image file for the sprite with the given name

sprite_has_selector(map, sprite, selector)

Returns boolean if sprite has the selector

sprite_image(*args)
sprite_map(glob, kwargs = {})

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:

        $icons: sprite-map("icons/*.png");
        background: sprite-url($icons) no-repeat;
        background: $icons no-repeat;

The sprite map object will generate the sprite map image, if necessary, the first time it is converted to a url. Simply constructing it has no side-effects.

sprite_map_name(map)

Returns the name of a sprite map The name is derived from the folder than contains the sprites.

sprite_position(map, sprite = nil, offset_x = ZERO, offset_y = ZERO)

Returns the position for the original image in the sprite. This is suitable for use as a value to background-position:

        $icons: sprite-map("icons/*.png");
        background-position: sprite-position($icons, new);

Might generate something like:

        background-position: 0 -34px;

You can adjust the background relative to this position by passing values for `$offset-x` and `$offset-y`:

        $icons: sprite-map("icons/*.png");
        background-position: sprite-position($icons, new, 3px, -2px);

Would change the above output to:

        background-position: 3px -36px;

sprite_url(map)

Returns a url to the sprite image.

### Protected Instance methods

convert_sprite_name(sprite)
missing_image!(map, sprite)
missing_sprite!(function_name)
verify_map(map, error = "sprite")
verify_sprite(sprite)

[Validate]