Skip to content

Instantly share code, notes, and snippets.

@lozandier
Last active November 14, 2015 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lozandier/faa9c6f8784a57366eaa to your computer and use it in GitHub Desktop.
Save lozandier/faa9c6f8784a57366eaa to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
// Create a function that inserts the string `@2x` right before the filename
// extension (you may assume the extension has a length of 3 characters).
@function retinize($filename) {
@return str-insert($filename, '@2x', str-index($filename, '.')); // make magic here
//@return str-insert( $filename, '@2x', -6)
}
.foo {
background: url("some-image.png");
@media retina { // this is pseudo-code
background: url( retinize("some-image.png.webp.apng") );
}
}
.foo {
background: url("some-image.png");
}
@media retina {
.foo {
background: url("some-image@2x.png.webp.apng");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment