Skip to content

Commit bb4db4c

Browse files
fix(rem): add rem function back (#14423)
Co-authored-by: Taylor Jones <tay1orjones@users.noreply.github.com>
1 parent 4b8ee4e commit bb4db4c

3 files changed

Lines changed: 45 additions & 0 deletions

File tree

packages/layout/scss/_convert.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ $base-font-size: 16px !default;
2727
@return math.div($px, $base-font-size) * 1rem;
2828
}
2929

30+
/// This function causes an error when using sass > 1.65.0
31+
/// Replaced with `to-rem` function
32+
/// @param {Number} $px - Number with px unit
33+
/// @return {Number} Number with rem unit
34+
/// @access public
35+
/// @deprecated
36+
/// @group @carbon/layout
37+
@function rem($px) {
38+
@if unit($px) != 'px' {
39+
@error "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
40+
}
41+
42+
@return math.div($px, $base-font-size) * 1rem;
43+
}
44+
3045
/// Convert a given px unit to a em unit
3146
/// @param {Number} $px - Number with px unit
3247
/// @return {Number} Number with em unit

packages/layout/scss/modules/_convert.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ $base-font-size: 16px !default;
2727
@return math.div($px, $base-font-size) * 1rem;
2828
}
2929

30+
/// This function causes an error when using sass > 1.65.0
31+
/// Replaced with `to-rem` function
32+
/// @param {Number} $px - Number with px unit
33+
/// @return {Number} Number with rem unit
34+
/// @access public
35+
/// @deprecated
36+
/// @group @carbon/layout
37+
@function rem($px) {
38+
@if unit($px) != 'px' {
39+
@error "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
40+
}
41+
42+
@return math.div($px, $base-font-size) * 1rem;
43+
}
44+
3045
/// Convert a given px unit to a em unit
3146
/// @param {Number} $px - Number with px unit
3247
/// @return {Number} Number with em unit

packages/styles/scss/utilities/_convert.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ $base-font-size: 16px !default;
2626
@return math.div($px, $base-font-size) * 1rem;
2727
}
2828

29+
/// This function causes an error when using sass > 1.65.0
30+
/// Replaced with `to-rem` function
31+
/// @param {Number} $px - Number with px unit
32+
/// @return {Number} Number with rem unit
33+
/// @access public
34+
/// @deprecated
35+
/// @group @carbon/layout
36+
@function rem($px) {
37+
@if unit($px) != 'px' {
38+
@error "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
39+
}
40+
41+
@return math.div($px, $base-font-size) * 1rem;
42+
}
43+
2944
/// Convert a given px unit to a em unit
3045
/// @param {Number} $px - Number with px unit
3146
/// @return {Number} Number with em unit

0 commit comments

Comments
 (0)