From b0e71321a99b952f2eb4c82fe10edcfed8cbcb25 Mon Sep 17 00:00:00 2001 From: Martijn Cuppens Date: Thu, 6 Dec 2018 22:31:57 +0100 Subject: Warn if rfs is imported more than once --- sass/_rfs.sass | 7 +++++++ scss/_rfs.scss | 8 ++++++++ stylus/rfs.styl | 10 ++++++++++ 3 files changed, 25 insertions(+) diff --git a/sass/_rfs.sass b/sass/_rfs.sass index faa283f..9f232f2 100644 --- a/sass/_rfs.sass +++ b/sass/_rfs.sass @@ -166,3 +166,10 @@ $rfs-breakpoint-unit: unit($rfs-breakpoint) // The responsive-font-size mixin uses RFS to rescale font sizes =responsive-font-size($fs, $important: false) +rfs($fs, $important) + +$rfs-is-included: false !default + +@if $rfs-is-included + @warn "Watch out, RFS is included more than once!" + +$rfs-is-included: true diff --git a/scss/_rfs.scss b/scss/_rfs.scss index 8aa9710..b9314d8 100644 --- a/scss/_rfs.scss +++ b/scss/_rfs.scss @@ -202,3 +202,11 @@ $rfs-breakpoint-unit: unit($rfs-breakpoint); @mixin responsive-font-size($fs, $important: false) { @include rfs($fs, $important); } + +$rfs-is-included: false !default; + +@if $rfs-is-included { + @warn "Watch out, RFS is included more than once!"; +} + +$rfs-is-included: true; diff --git a/stylus/rfs.styl b/stylus/rfs.styl index 8e15945..00b48ab 100644 --- a/stylus/rfs.styl +++ b/stylus/rfs.styl @@ -49,6 +49,9 @@ $rfs-breakpoint-unit = unit($rfs-breakpoint) // Remove unit from $rfs-breakpoint for calculations if $rfs-breakpoint-unit == "px" $rfs-breakpoint = unit($rfs-breakpoint, "") +else if $rfs-breakpoint-unit == "" + // Use `px` as default + $rfs-breakpoint-unit = "px" else if $rfs-breakpoint-unit == "rem" or $rfs-breakpoint-unit == "em" $rfs-breakpoint = unit($rfs-breakpoint * $rfs-rem-value, "") @@ -172,3 +175,10 @@ rfs($fs, $important = false) // The responsive-font-size mixin uses RFS to rescale font sizes responsive-font-size($fs, $important = false) rfs($fs, $important) + +$rfs-is-included ?= false + +if $rfs-is-included + warn("Watch out, RFS is included more than once!") + +$rfs-is-included = true -- cgit v1.2.3