From ca51f2773e9fd893a54c6466acbe6884885fd8b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Heibu=CC=88lt?= Date: Fri, 21 Oct 2016 09:39:31 +0200 Subject: [PATCH] [refs #204] Remove `rem`-function and -mixin --- components/_example.components.buttons.scss | 4 +- example.main.scss | 3 -- generic/_generic.shared.scss | 4 +- test/_tools.rem.scss | 33 -------------- test/tests.scss | 1 - tools/_tools.rem.scss | 48 --------------------- 6 files changed, 4 insertions(+), 89 deletions(-) delete mode 100644 test/_tools.rem.scss delete mode 100644 tools/_tools.rem.scss diff --git a/components/_example.components.buttons.scss b/components/_example.components.buttons.scss index 52905df..727475a 100644 --- a/components/_example.components.buttons.scss +++ b/components/_example.components.buttons.scss @@ -98,11 +98,11 @@ ========================================================================== */ .c-btn--small { - padding: inuit-rem($inuit-global-spacing-unit-tiny) inuit-rem($inuit-global-spacing-unit-small); + padding: $inuit-global-spacing-unit-tiny $inuit-global-spacing-unit-small; } .c-btn--large { - padding: inuit-rem($inuit-global-spacing-unit) inuit-rem($inuit-global-spacing-unit-large); + padding: $inuit-global-spacing-unit $inuit-global-spacing-unit-large; } diff --git a/example.main.scss b/example.main.scss index aff4632..4562b13 100644 --- a/example.main.scss +++ b/example.main.scss @@ -23,8 +23,6 @@ * Global...............Project-wide variables and settings. * * TOOLS - * Rem..................Tools for converting pixel inputs into their rem - * equivalents. * Font-size............A mixin which guarantees baseline-friendly line-heights. * Clearfix.............Micro clearfix mixin. * Hidden...............Mixin for hiding elements. @@ -84,7 +82,6 @@ // TOOLS -@import "tools/tools.rem"; @import "tools/tools.font-size"; @import "tools/tools.clearfix"; @import "tools/tools.hidden"; diff --git a/generic/_generic.shared.scss b/generic/_generic.shared.scss index 42c73fd..b016d94 100644 --- a/generic/_generic.shared.scss +++ b/generic/_generic.shared.scss @@ -21,7 +21,7 @@ figure, hr, table, fieldset { - @include inuit-rem(margin-bottom, $inuit-global-spacing-unit); + margin-bottom: $inuit-global-spacing-unit; } @@ -30,7 +30,7 @@ fieldset { */ dd, ol, ul { - @include inuit-rem(margin-left, $inuit-global-spacing-unit); + margin-left: $inuit-global-spacing-unit; } /* stylelint-enable selector-list-comma-newline-after */ diff --git a/test/_tools.rem.scss b/test/_tools.rem.scss deleted file mode 100644 index 1fbb38b..0000000 --- a/test/_tools.rem.scss +++ /dev/null @@ -1,33 +0,0 @@ -@import "true"; - -@import "../settings/settings.core"; -@import "../tools/tools.rem"; - - -@include test-module("[function] inuit-rem") { - - @include test("it should convert a pixel value to it's rem equivalent") { - - $test: inuit-rem(18px); - $expect: 1.125rem; - @include assert-equal($test, $expect, "Returns the rem equivalant for pixel value"); - } -} - -@include test-module("[mixin] inuit-rem") { - - @include test("it should output a property with a rem value converted from a pixel value") { - - @include assert() { - - @include output { - @include inuit-rem(padding, 10px); - } - - @include expect { - padding: 10px; - padding: 0.625rem; - } - } - } -} diff --git a/test/tests.scss b/test/tests.scss index acbef5e..16c433d 100644 --- a/test/tests.scss +++ b/test/tests.scss @@ -9,7 +9,6 @@ @import 'true'; @import '_tools.font-size.scss'; -@import '_tools.rem.scss'; @import '_utilities.widths.scss'; @include report(); diff --git a/tools/_tools.rem.scss b/tools/_tools.rem.scss deleted file mode 100644 index c660eab..0000000 --- a/tools/_tools.rem.scss +++ /dev/null @@ -1,48 +0,0 @@ -///* ======================================================================== -// #REM -// ======================================================================== */ - -// Convert any px value into its rem equivalent. - -@function inuit-rem($value) { - - @if (type-of($value) == number) { - - @if (unit($value) != "px") { - @error "`#{$value}` needs to be a pixel value."; - } - - } @else { - @error "`#{$value}` needs to be a number."; - } - - @return $value / $inuit-global-font-size * 1rem; - -} - - -// Mixin to create a declaration whose value is a rem unit. Also provide pixel -// fallback. -// -// .simple-usage { -// @include inuit-rem(padding, 10px); -// } - -@mixin inuit-rem($property, $value) { - - @if (type-of($value) == number) { - - @if (unit($value) != "px") { - @error "`#{$value}` needs to be a pixel value."; - } - - } @else { - @error "`#{$value}` needs to be a number."; - } - - // We provide a `px` fallback for old IEs not supporting `rem` values. - #{$property}: $value; - - #{$property}: inuit-rem($value); - -}