Created
November 3, 2018 22:53
-
-
Save jstewsy/95db554c056a10fdf7d780344cd12acb to your computer and use it in GitHub Desktop.
svg background image scss mixin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* svg-background-image | |
* | |
* apply svg/png background-image pattern for IE8 and Android <2.3 support | |
* uses `linear-gradient` method demostrated here | |
* https://css-tricks.com/svg-fallbacks/#the-fallbacks | |
*/ | |
@mixin svg-background-image($image-path: '/', $image-name, $fallback-file-extension: 'png', $repeat: no-repeat) { | |
background-image: image-url("#{image-path}#{$image-name}.#{$fallback-file-extension}"); | |
background-image: linear-gradient(transparent, transparent), image-url("#{image-path}#{$image-name}.svg"); // scss-lint:disable DuplicateProperty | |
background-repeat: $repeat; | |
@content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment