Skip to content

Instantly share code, notes, and snippets.

@jacine
Created October 17, 2012 18:36
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacine/3907268 to your computer and use it in GitHub Desktop.
Save jacine/3907268 to your computer and use it in GitHub Desktop.
Automated Retina Sprites with Compass

Automated Retina Sprites with Compass

I asked the following on Twitter the other day:

Thoughts, anyone? "Seems like there are a million ways to do retina sprites with Compass. What's the best way? #sass #compass" tweet

Specifically, what I wanted to do was to reference an icon once, like so:

.selector {
  @include the-sprite('once');
}`

And get:

.selector {
   // The regular icon.
}
@media ( the retina query ) {
  .selector {
    // The retina version.
    }
}

To my surprise I got a couple of really helpful replies. Both @Snugug and @krisbulman sent some code my way that does just what I'm looking for. Thanks guys!! ♥

Both of these scripts are incredibly useful and one may suit your use case better than the other, so I encourage you to check them both out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment