From 7620d29d9d551f08b98251ca5fe19c78b020df27 Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Sun, 16 Feb 2020 14:32:54 -0700 Subject: [PATCH] Move pxToRem to functions partial --- assets/css/_sass/_functions.scss | 11 +++++++++++ assets/css/base.scss | 17 ++--------------- 2 files changed, 13 insertions(+), 15 deletions(-) create mode 100644 assets/css/_sass/_functions.scss diff --git a/assets/css/_sass/_functions.scss b/assets/css/_sass/_functions.scss new file mode 100644 index 00000000..8e7b4737 --- /dev/null +++ b/assets/css/_sass/_functions.scss @@ -0,0 +1,11 @@ +@function pxToRem($pixels, $context: $browser-context) { + @if (unitless($pixels)) { + $pixels: $pixels * 1px; + } + + @if (unitless($context)) { + $context: $context * 1px; + } + + @return $pixels / $context * 1rem; +} diff --git a/assets/css/base.scss b/assets/css/base.scss index 2b44e124..bc5a1465 100644 --- a/assets/css/base.scss +++ b/assets/css/base.scss @@ -2,23 +2,10 @@ @import url('https://use.typekit.net/qlo3dpu.css'); @import '~prism-themes/themes/prism-a11y-dark'; - -// FUNCTIONS +@import '_sass/functions'; $browser-context: 16; -@function pxToRem($pixels, $context: $browser-context) { - @if (unitless($pixels)) { - $pixels: $pixels * 1px; - } - - @if (unitless($context)) { - $context: $context * 1px; - } - - @return $pixels / $context * 1rem; -} - pre[class*='language-'] { font-size: 1rem; } @@ -96,7 +83,7 @@ $bold: 700; body { border-top: 1rem solid red; font-family: $sans-serif; - font-size: rem(20); + font-size: pxToRem(20); padding: 2rem; margin: 0; }