Created
November 2, 2011 14:52
-
-
Save chriseppstein/1333822 to your computer and use it in GitHub Desktop.
generate an inline sprite.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@include "icon/*.png"; | |
#{$icon-sprite-base-class} { | |
background-image: inline-sprite($icon-sprites); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copy this to your compass config. | |
module Sass::Script::Functions | |
def sprite_path(map) | |
Sass::Script::String.new("#{map.path}-s#{map.uniqueness_hash}.png") | |
end | |
declare :sprite_path, [:map] | |
def inline_sprite(map) | |
verify_map(map, "sprite-url") | |
map.generate | |
inline_image(sprite_path(map)) | |
end | |
declare :inline_sprite, [:map] | |
end |
it's been asked for a couple times. I'm not opposed. I guess there would be some config variable that would cause the background-image to get set like this after the other background image is set to the url (so it can degrade).
I used to think it was kind of pointless, but @hcatlin pointed out that a sprite map is smaller than the individual files so there is some win here.
how about a config variable to toggle the desired output? like $icon-inline:true;
Sure
Hunt & pecked on my iPhone... Sorry if it's brief!
…On Nov 4, 2011, at 6:46 AM, Scott ***@***.*** wrote:
how about a config variable to toggle the desired output? like `$icon-inline:true;`
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1333822
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
we want this in core?