Skip to content

Commit eef3a83

Browse files
author
AMJones
committed
Allows for AND in media condition lists for chaining.
1 parent a8b1f93 commit eef3a83

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

scss/_rwd-functions.scss

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
@if(type-of($nth) == list) {
148148
$compiled-list: append($compiled-list, media-condition($nth), comma );
149149
} @else {
150-
$condition: unquote(quote(nth($conditions,$i)));
150+
$condition: unquote(quote($nth));
151151
// Basic String Conditions
152152
@if map-has-key($condition-map, $condition) {
153153
$pre: map-get($condition-map,$condition);
@@ -161,13 +161,17 @@
161161
}
162162
} @else {
163163
$operator: get-expression-operator($condition);
164-
$value: get-expression-value($condition,$operator);
165-
@if map-has-key($grid-breakpoints, $value) {
166-
// Breakpoint Based Conditions
167-
$compiled-list: append($compiled-list, get-breakpoint-string($value, $operator), comma);
164+
@if $operator != unquote("") {
165+
$value: get-expression-value($condition,$operator);
166+
@if map-has-key($grid-breakpoints, $value) {
167+
// Breakpoint Based Conditions
168+
$compiled-list: append($compiled-list, get-breakpoint-string($value, $operator), comma);
169+
} @else {
170+
// Width Based Condition
171+
$compiled-list: append($compiled-list, get-width-string($operator,$value,$value), comma );
172+
}
168173
} @else {
169-
// Width Based Condition
170-
$compiled-list: append($compiled-list, get-width-string($operator,$value,$value), comma );
174+
$compiled-list: append($compiled-list, $condition, comma );
171175
}
172176
}
173177
}
@@ -180,7 +184,11 @@
180184
$sep: '';
181185

182186
@if $conditions-string != '' {
183-
$sep: unquote(", ");
187+
@if $last != "and" {
188+
$sep: unquote(", ");
189+
} @else {
190+
$sep: unquote(" ");
191+
}
184192
}
185193

186194
$conditions-string: $conditions-string + $sep + $this;

0 commit comments

Comments
 (0)