Skip to content

Instantly share code, notes, and snippets.

@myabc
Created November 6, 2012 16:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myabc/4025755 to your computer and use it in GitHub Desktop.
Save myabc/4025755 to your computer and use it in GitHub Desktop.
# config/initializers/compass_patch.rb
module Compass::SassExtensions::Functions::Sprites
# Returns boolean if sprite has the selector
def sprite_has_selector(map, sprite, selector)
sprite = convert_sprite_name(sprite)
verify_map map
verify_sprite sprite
unless VALID_SELECTORS.include?(selector.value)
raise Sass::SyntaxError, "Invalid Selctor did you mean one of: #{VALID_SELECTORS.join(', ')}"
end
Sass::Script::Bool.new map.send(:"has_#{selector.value}?", sprite.value)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment