Skip to content

Instantly share code, notes, and snippets.

@cimmanon
Last active August 29, 2015 14:20
Show Gist options
  • Save cimmanon/e07d3fd4f67452412ad0 to your computer and use it in GitHub Desktop.
Save cimmanon/e07d3fd4f67452412ad0 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<p class="007">bond</p>
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
@function escape_leading_numbers($s) {
$first-char: str_slice(#{$s}, 0, 1);
$found: index('1' '2' '3' '4' '5' '6' '7' '8' '9' '0', $first-char);
@return if($found, unquote(str-insert(str-slice(#{$s}, 2), "\\3#{$first-char} ", 1)), $s);
}
$name: '007';
.#{escape_leading_numbers($name)} {
color: red;
}
@each $car in
bmwwhite
hondared
22ltr-porche
30ltr-cossworth
{
.#{escape_leading_numbers($car)} {
background:url(/img/cars/#{$car}.jpg) no-repeat
}
}
.\30 07 {
color: red;
}
.bmwwhite {
background: url(/img/cars/bmwwhite.jpg) no-repeat;
}
.hondared {
background: url(/img/cars/hondared.jpg) no-repeat;
}
.\32 2ltr-porche {
background: url(/img/cars/22ltr-porche.jpg) no-repeat;
}
.\33 0ltr-cossworth {
background: url(/img/cars/30ltr-cossworth.jpg) no-repeat;
}
<p class="007">bond</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment