-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
_images.scss
152 lines (133 loc) · 4.9 KB
/
_images.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
@import "compass/support";
@import "compass/utilities/general/hacks";
$gradient-support-threshold: $graceful-usage-threshold !default;
$svg-gradient-shim-threshold: $graceful-usage-threshold !default;
$border-image-support-threshold: $graceful-usage-threshold !default;
$owg-threshold: $graceful-usage-threshold !default;
// Compass assumes you will use the official gradient syntax,
// unless otherwise instructed.
$use-legacy-gradient-syntax: false !default;
// Create a linear gradient using standard official or legacy syntax.
// This function must be included in one of the following
// image module mixins to work properly.
@function linear-gradient($angle, $details...) {
$legacy-syntax: $use-legacy-gradient-syntax;
@if type-of($angle) != 'number' {
$angle: compact($angle);
$legacy-syntax: if(index($angle, 'to'), false, true);
}
@if $legacy-syntax {
@return _linear-gradient_legacy($angle, $details...);
} @else {
@return _linear-gradient($angle, $details...);
}
}
// These browsers support svg but not gradients
// so we can shim the gradient with an inline svg file.
$browsers-supporting-svg-but-not-gradients: (ie: "9", opera: "9.5-9.6");
// These browsers require the old webkit gradient syntax
$browsers-supporting-old-webkit-gradients: (android: ("2.1", "3"));
@mixin each-gradient-prefix($values) {
@if prefixed(-svg, $values) {
@include for-legacy-browsers($browsers-supporting-svg-but-not-gradients,
$svg-gradient-shim-threshold)
{
@include with-prefix(-svg) {
@content;
}
}
}
@if prefixed(-owg, $values) {
@include for-legacy-browsers($browsers-supporting-old-webkit-gradients,
$owg-threshold)
{
@include with-prefix(-owg) {
@content;
}
}
}
@include with-each-prefix(css-gradients, $gradient-support-threshold) {
@if $current-prefix {
@if prefixed($current-prefix, $values) {
@content;
} @else if $debug-browser-support {
/* There is not a value that needs to be prefixed with #{$current-prefix} in: #{$values} */
}
} @else {
@content;
}
}
}
@mixin image-property($property, $values...) {
@include each-gradient-prefix($values) {
@if $current-prefix {
#{$property}: prefix($current-prefix, $values);
} @else {
#{$property}: $values;
}
@content;
}
}
// Background property support for vendor prefixing within values.
@mixin background($backgrounds...) {
@include image-property(background, $backgrounds...);
}
// Set any number of background layers, along with a fallback.
// The final argument will be output separately, first, as a css2 fallback.
@mixin background-with-css2-fallback($backgrounds...) {
@if length($backgrounds) > 1 or prefixed(-css2, $backgrounds) {
background: -css2(nth($backgrounds, -1));
}
@include background($backgrounds...);
}
// Background image property support for vendor prefixing within values.
@mixin background-image($images...) {
@include image-property(background-image, $images...) {
@if $current-prefix == -svg {
background-size: 100%;
}
}
}
// Emit a IE-Specific filters that renders a simple linear gradient.
// For use in IE 6 - 8. Best practice would have you apply this via a
// conditional IE stylesheet, but if you must, you should place this before
// any background-image properties that you have specified.
//
// For the `$orientation` parameter, you can pass `vertical` or `horizontal`.
@mixin filter-gradient(
$start-color,
$end-color,
$orientation: vertical
) {
@include for-legacy-browsers((ie: "8"), $gradient-support-threshold) {
@include has-layout;
$gradient-type: if($orientation == vertical, 0, 1);
filter: progid:DXImageTransform.Microsoft.gradient(gradientType=#{$gradient-type}, startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}');
}
}
// Border image property support for vendor prefixing properties and values.
@mixin border-image($value) {
@include with-each-prefix(border-image, $border-image-support-threshold) {
$border-prefix: $current-prefix;
@include each-gradient-prefix($value) {
@if $current-prefix and prefixed($current-prefix, $value) {
$legacy-value: reject($value, fill);
@include prefix-prop(border-image, prefix($current-prefix, $legacy-value), $prefix: $border-prefix);
} @else {
@include prefix-prop(border-image, $value, $prefix: $border-prefix);
}
}
}
}
// List style image property support for vendor prefixing within values.
@mixin list-style-image($image) {
@include image-property(list-style-image, $image);
}
// List style property support for vendor prefixing within values.
@mixin list-style($value) {
@include image-property(list-style, $value);
}
// content property support for vendor prefixing within values.
@mixin content($value) {
@include image-property(content, $value);
}