Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save benjamindean/9970390 to your computer and use it in GitHub Desktop.
Save benjamindean/9970390 to your computer and use it in GitHub Desktop.
Creates SVG background image with PNG fallback. Example: @include('picture', 'center', 'center', 'no-repeat', 'fallback'); #{$imgFallback} - global var, folder with fallbacks.
@mixin image($name, $x, $y, $repeat, $fallback: "") {
@if $fallback == "fallback" {
background: url(#{$imgFallback}/#{$name}.png) $x $y $repeat;
background: rgba(0, 0, 0, 0) url(#{$img}/#{$name}.svg) $x $y $repeat;
}
@else {
background: url(#{$img}/#{$name}.png) $x $y $repeat;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment