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-10-13 17:26:25 +0300
committerGitHub <noreply@github.com>2018-10-13 17:26:25 +0300
commitc0d1561491cf2ee4f9813a1ca697c3f73982b850 (patch)
treeba1fc24c4f10b1407f69f4437d3232ff4a12e476
parent94886c752506a99ead4c84829b392d780b8176e8 (diff)
parent35f9482afc821854a43f3f2c4ae4913998b7e31e (diff)
Merge pull request #25 from project-rfs/fix-unitless
Fix unitless bug
-rw-r--r--examples/postcss/gulp/dest/main.css7
-rw-r--r--examples/postcss/node/dest/main.css7
-rw-r--r--examples/stylus/gulp/dest/main.css7
-rw-r--r--examples/stylus/node/dest/main.css7
-rw-r--r--postcss/rfs.js2
-rw-r--r--sass/_rfs.sass2
-rw-r--r--scss/_rfs.scss2
-rw-r--r--stylus/rfs.styl2
8 files changed, 28 insertions, 8 deletions
diff --git a/examples/postcss/gulp/dest/main.css b/examples/postcss/gulp/dest/main.css
index 64fe4ab..2a8d061 100644
--- a/examples/postcss/gulp/dest/main.css
+++ b/examples/postcss/gulp/dest/main.css
@@ -64,5 +64,10 @@
/* responsive-font-size property without unit */
.selector-8 {
- font-size: 32;
+ font-size: 2rem;
+}
+@media (max-width: 1200px) {
+ .selector-8 {
+ font-size: calc(1.2rem + 1.066667vw);
+ }
}
diff --git a/examples/postcss/node/dest/main.css b/examples/postcss/node/dest/main.css
index 64fe4ab..2a8d061 100644
--- a/examples/postcss/node/dest/main.css
+++ b/examples/postcss/node/dest/main.css
@@ -64,5 +64,10 @@
/* responsive-font-size property without unit */
.selector-8 {
- font-size: 32;
+ font-size: 2rem;
+}
+@media (max-width: 1200px) {
+ .selector-8 {
+ font-size: calc(1.2rem + 1.066667vw);
+ }
}
diff --git a/examples/stylus/gulp/dest/main.css b/examples/stylus/gulp/dest/main.css
index 119904f..74979f5 100644
--- a/examples/stylus/gulp/dest/main.css
+++ b/examples/stylus/gulp/dest/main.css
@@ -57,5 +57,10 @@
}
/* responsive-font-size property without unit */
.selector-8 {
- font-size: 32;
+ font-size: 2rem;
+}
+@media (max-width: 1200px) {
+ .selector-8 {
+ font-size: calc(1.2rem + 1.066666666666667vw);
+ }
}
diff --git a/examples/stylus/node/dest/main.css b/examples/stylus/node/dest/main.css
index 119904f..74979f5 100644
--- a/examples/stylus/node/dest/main.css
+++ b/examples/stylus/node/dest/main.css
@@ -57,5 +57,10 @@
}
/* responsive-font-size property without unit */
.selector-8 {
- font-size: 32;
+ font-size: 2rem;
+}
+@media (max-width: 1200px) {
+ .selector-8 {
+ font-size: calc(1.2rem + 1.066666666666667vw);
+ }
}
diff --git a/postcss/rfs.js b/postcss/rfs.js
index 1caf191..6bfe674 100644
--- a/postcss/rfs.js
+++ b/postcss/rfs.js
@@ -69,7 +69,7 @@ module.exports = postcss.plugin('postcss-rfs', function (opts) {
decl.prop = 'font-size';
// Skip if value is not in px or rem
- if (!new RegExp(/(\d*\.?\d+)(px|rem)/g).test(decl.value)) {
+ if (isNaN(decl.value) && !new RegExp(/(\d*\.?\d+)(px|rem)/g).test(decl.value)) {
return;
}
diff --git a/sass/_rfs.sass b/sass/_rfs.sass
index 0422dd6..91afccc 100644
--- a/sass/_rfs.sass
+++ b/sass/_rfs.sass
@@ -64,7 +64,7 @@ $rfs-breakpoint-unit: unit($rfs-breakpoint)
$rfs-suffix: if($important, " !important", "")
// If $fs isn't a number (like inherit) or $fs has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
- @if not $fs-unit or not $fs-unit != "" and $fs-unit != "px" and $fs-unit != "rem" or $fs == 0
+ @if not $fs-unit or $fs-unit != "" and $fs-unit != "px" and $fs-unit != "rem" or $fs == 0
font-size: #{$fs}#{$rfs-suffix}
@else
// Variables for storing static and fluid rescaling
diff --git a/scss/_rfs.scss b/scss/_rfs.scss
index 172a684..cc45f6b 100644
--- a/scss/_rfs.scss
+++ b/scss/_rfs.scss
@@ -69,7 +69,7 @@ $rfs-breakpoint-unit: unit($rfs-breakpoint);
$rfs-suffix: if($important, " !important", "");
// If $fs isn't a number (like inherit) or $fs has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
- @if not $fs-unit or not $fs-unit != "" and $fs-unit != "px" and $fs-unit != "rem" or $fs == 0 {
+ @if not $fs-unit or $fs-unit != "" and $fs-unit != "px" and $fs-unit != "rem" or $fs == 0 {
font-size: #{$fs}#{$rfs-suffix};
}
@else {
diff --git a/stylus/rfs.styl b/stylus/rfs.styl
index b423bb4..f976af7 100644
--- a/stylus/rfs.styl
+++ b/stylus/rfs.styl
@@ -55,7 +55,7 @@ rfs($fs, $important = false)
$rfs-suffix = !important
// If $fs isn't a number (like inherit) or $fs has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
- if type-of($fs) != "unit" or (unit($fs) != "px" and unit($fs) != "rem") or $fs == 0
+ if type-of($fs) != "unit" or (unit($fs) != "" and unit($fs) != "px" and unit($fs) != "rem") or $fs == 0
font-size: "%s%s" % ($fs $rfs-suffix)
else
// Variables for storing static and fluid rescaling