Skip to content

Instantly share code, notes, and snippets.

@rozzy
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save rozzy/53df994e1f11a6238642 to your computer and use it in GitHub Desktop.

Select an option

Save rozzy/53df994e1f11a6238642 to your computer and use it in GitHub Desktop.
Auto retina images with background-size
.image(@img, @type: auto){
@filename : ~`/(.*)\.(jpg|jpeg|png|gif)/.exec(@{img})[1]`;
@extension : ~`/(.*)\.(jpg|jpeg|png|gif)/.exec(@{img})[2]`;
background-image:~"url(@{imgPath}@{filename}.@{extension})";
.lh-background-size(@type);
&.retina {
background-image:~"url(@{imgPath}@{filename}@2x.@{extension})";
.lh-background-size(@type);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment