stylesheets/singularitygs/helpers/_find.scss in singularitygs-1.0.1 vs stylesheets/singularitygs/helpers/_find.scss in singularitygs-1.0.2

- old
+ new

@@ -9,64 +9,73 @@ @if $user-object != false { @return $user-object; } @else if $length > 1 { - $query-min: breakpoint-get-context('min-width'); - $query-max: breakpoint-get-context('max-width'); + ////////////////////////////// + // @TODO! REplace with Native Sass Fucntion when vailable! + // https://github.com/nex3/sass/pull/689 + ////////////////////////////// + @if (is-breakpoint-list($haystack) != false) { + $query-min: breakpoint-get-context('min-width'); + $query-max: breakpoint-get-context('max-width'); - // If we've got a min-width or max-width - @if $query-min or $query-max { - // Reverse the grid so we can step through it - $reverse-haystack: (); - @for $i from 2 through $length { - $reverse-haystack: append($reverse-haystack, nth($haystack, $i), comma); - } - $reverse-haystack: reverse($reverse-haystack); - $rg-length: $length - 1; + // If we've got a min-width or max-width + @if $query-min or $query-max { + // Reverse the grid so we can step through it + $reverse-haystack: (); + @for $i from 2 through $length { + $reverse-haystack: append($reverse-haystack, nth($haystack, $i), comma); + } + $reverse-haystack: reverse($reverse-haystack); + $rg-length: $length - 1; - // Grab the largest and smallest MQs - $smallest: nth(nth($haystack, 2), 2); - $largest: nth(nth($reverse-haystack, 1), 2); - $context: $query-min; + // Grab the largest and smallest MQs + $smallest: nth(nth($haystack, 2), 2); + $largest: nth(nth($reverse-haystack, 1), 2); + $context: $query-min; - @if not ($mobile-first) { - $context: $query-max; - } + @if not ($mobile-first) { + $context: $query-max; + } - // If it's smallest than the smallest MQ, use the 1st grid - @if $context < $smallest { - @return nth($haystack, 1); - } - // If it's larger than or equal to the largest MQ, use the last grid - @else if $context >= $largest { - @return nth(nth($reverse-haystack, 1), 1); - } - // If it's in between the smallest and largest, go run a check. - @else { - // Loop through each MQ. - @for $j from 1 through $rg-length { - $query: nth(nth($reverse-haystack, $j), 2); + // If it's smallest than the smallest MQ, use the 1st grid + @if $context < $smallest { + @return nth($haystack, 1); + } + // If it's larger than or equal to the largest MQ, use the last grid + @else if $context >= $largest { + @return nth(nth($reverse-haystack, 1), 1); + } + // If it's in between the smallest and largest, go run a check. + @else { + // Loop through each MQ. + @for $j from 1 through $rg-length { + $query: nth(nth($reverse-haystack, $j), 2); - // If the MQ is greather than or equal to the the MQ in question, use it! (mobile first) - @if ($mobile-first) { - @if $context >= $query { - @return nth(nth($reverse-haystack, $j), 1); + // If the MQ is greather than or equal to the the MQ in question, use it! (mobile first) + @if ($mobile-first) { + @if $context >= $query { + @return nth(nth($reverse-haystack, $j), 1); + } } - } - // If the MQ is less than or equal to the the MQ in question, use it! (not mobile first) - @else { - @if $context <= $query { - @return nth(nth($reverse-haystack, $j), 1); + // If the MQ is less than or equal to the the MQ in question, use it! (not mobile first) + @else { + @if $context <= $query { + @return nth(nth($reverse-haystack, $j), 1); + } } } } } + // All else fails, return the first grid + @else { + @return nth($haystack, 1); + } } - // All else fails, return the first grid @else { - @return nth($haystack, 1); + @return $haystack; } } // All else fails, return the first grid @else { @return nth($haystack, 1); \ No newline at end of file