Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit ea55f37

Browse files
author
Markus Falk
committed
[Feature] add option for alternate fallback image
1 parent 0715d25 commit ea55f37

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

_base64-background-image.scss

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1-
@mixin base64-background-image($url) {
1+
@mixin base64-background-image($url, $altFallback:"") {
2+
3+
// scope
4+
$fallbackURL: "";
5+
6+
// use alternate fallback image if given
7+
@if $altFallback == "" {
8+
$fallbackURL: $url;
9+
} @else {
10+
$fallbackURL: $altFallback;
11+
}
12+
13+
// default use case: single icon
214
background-repeat: no-repeat;
15+
16+
// svg
317
background-image: inline-image($url + '.svg');
18+
19+
// png fallback
420
.no-svg & {
5-
background-image: image-url($url + '.png');
21+
background-image: image-url($fallbackURL + '.png');
622
}
723
}

0 commit comments

Comments
 (0)