Skip to content

Commit 9cc98dc

Browse files
authored
Merge pull request #332 from BeAPI/feature/mixin-bg
mixin bg retina
2 parents e99b67d + eddf3c4 commit 9cc98dc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Background retina
3+
* Use with caution
4+
*
5+
* examples :
6+
* @include background-static("your-image");
7+
*
8+
*/
9+
10+
@mixin background-static($filename, $retina: true, $position: center center, $size: auto 100%, $type: "png" ) {
11+
background-image: url(../img/static/#{$filename}.#{$type});
12+
background-repeat: no-repeat;
13+
background-position: $position;
14+
background-size: $size;
15+
16+
@if ($retina) {
17+
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
18+
background-image: url(../img/static/#{$filename}@2x.#{$type});
19+
}
20+
}
21+
}

src/scss/02-tools/tools.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@
3535
@import "./m-reduced-motion";
3636
@import "./m-bg-fullwidth";
3737
@import "./m-block-vertical-spacing";
38+
@import "./m-background-static";

0 commit comments

Comments
 (0)