Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Cuppens <martijn.cuppens@gmail.com>2018-12-07 00:38:19 +0300
committerGitHub <noreply@github.com>2018-12-07 00:38:19 +0300
commit33aa7faa4941381c77577113d4460175a600023d (patch)
tree6c4ea1784c191cb4d866e1971900eb29104f75f0
parent58facdc9adfdb75c392dacc53ab84960a9a1e5df (diff)
parentb0e71321a99b952f2eb4c82fe10edcfed8cbcb25 (diff)
Warn if rfs is imported more than once (#50)
-rw-r--r--sass/_rfs.sass7
-rw-r--r--scss/_rfs.scss8
-rw-r--r--stylus/rfs.styl10
3 files changed, 25 insertions, 0 deletions
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