Skip to content

Commit

Permalink
Added scssphp compatibility, fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Burel committed Jul 24, 2016
1 parent 5466455 commit 9647e2f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions _rem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ $rem-px-only: false !default;
@function rem-convert($to, $values...) {
$result: ();
$separator: rem-separator($values);

@each $value in $values {
@if type-of($value) == "number" and unit($value) == "rem" and $to == "px" {
$result: append($result, $value / 1rem * $rem-baseline, $separator);
$result: append($result, $value / 1rem * $rem-baseline + 0px, $separator);
} @else if type-of($value) == "number" and unit($value) == "px" and $to == "rem" {
$result: append($result, $value / ($rem-baseline / 1rem), $separator);
$result: append($result, $value / $rem-baseline + 0rem, $separator);
} @else if type-of($value) == "list" {
$result: append($result, rem-convert($to, $value...), $separator);
$tmp-separator: list-separator($value);
$tmp: rem-convert($to, $value...);
$tmp: append($tmp, null, $tmp-separator);
$result: append($result, $tmp, $separator);
} @else {
$result: append($result, $value, $separator);
}
Expand Down

0 comments on commit 9647e2f

Please sign in to comment.