From 53e71908afc75c34d802deaf029410eff0bbc971 Mon Sep 17 00:00:00 2001 From: Kenneth Ormandy Date: Fri, 17 Oct 2014 18:55:44 -0700 Subject: [PATCH] Adds not function for Libsass compatibility - Closes #254 --- .../stylesheets/functions/_new-breakpoint.scss | 2 +- app/assets/stylesheets/functions/_private.scss | 12 +++++++++--- app/assets/stylesheets/grid/_media.scss | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/functions/_new-breakpoint.scss b/app/assets/stylesheets/functions/_new-breakpoint.scss index c00e3ccf..1bebad50 100644 --- a/app/assets/stylesheets/functions/_new-breakpoint.scss +++ b/app/assets/stylesheets/functions/_new-breakpoint.scss @@ -41,7 +41,7 @@ $query: append($query, $total-columns); } - @if not belongs-to($query, $visual-grid-breakpoints) { + @if is-not(belongs-to($query, $visual-grid-breakpoints)) { $visual-grid-breakpoints: append($visual-grid-breakpoints, $query, comma) !global; } diff --git a/app/assets/stylesheets/functions/_private.scss b/app/assets/stylesheets/functions/_private.scss index 16d5b9bc..872d4dc5 100644 --- a/app/assets/stylesheets/functions/_private.scss +++ b/app/assets/stylesheets/functions/_private.scss @@ -1,15 +1,21 @@ +// Not function for Libsass compatibility +// https://github.com/sass/libsass/issues/368 +@function is-not($value) { + @return if($value, false, true); +} + // Checks if a number is even @function is-even($int) { - @return $int % 2 == 0 + @return $int % 2 == 0; } // Checks if an element belongs to a list or not @function belongs-to($tested-item, $list) { - @return not not-belongs-to($tested-item, $list); + @return is-not(not-belongs-to($tested-item, $list)); } @function not-belongs-to($tested-item, $list) { - @return not index($list, $tested-item); + @return is-not(index($list, $tested-item)); } // Contains display value diff --git a/app/assets/stylesheets/grid/_media.scss b/app/assets/stylesheets/grid/_media.scss index 06f2aa4b..2c23fb63 100644 --- a/app/assets/stylesheets/grid/_media.scss +++ b/app/assets/stylesheets/grid/_media.scss @@ -68,7 +68,7 @@ $default-grid-columns: $grid-columns; $grid-columns: $total-columns !global; - @if not is-even(length($query)) { + @if is-not(is-even(length($query))) { $grid-columns: nth($query, $loop-to) !global; $loop-to: $loop-to - 1; }