Skip to content

Instantly share code, notes, and snippets.

@dstaley
Created October 27, 2015 15:49
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 dstaley/27eefcff931267a3c0f9 to your computer and use it in GitHub Desktop.
Save dstaley/27eefcff931267a3c0f9 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
@function swatch($color) {
@return to_lower_case(str-replace($color, " ", "_"));
}
$swatch_colors: "Baby Blue", "Laxton Cherry", "Whitewash";
@each $color in $swatch_colors {
span[data-original-title="#{$color}"] {
background-image: url('/images/swatch_#{swatch($color)}.jpg');
}
}
span[data-original-title="Baby Blue"] {
background-image: url("/images/swatch_baby_blue.jpg");
}
span[data-original-title="Laxton Cherry"] {
background-image: url("/images/swatch_laxton_cherry.jpg");
}
span[data-original-title="Whitewash"] {
background-image: url("/images/swatch_whitewash.jpg");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment