Encountering an issue while compiling a scss file to css, the error message reads as follows:
Error: src/scss/_custom.scss
Error: Incompatible units: 'rem' and 'px'.
To address this, I inserted @debug directives above the problematic line to identify the variables causing the error.
Surprisingly, the @debug directive displays two values per variable:
src/scss/_custom.scss:346 DEBUG: $font-size-base `1rem`
src/scss/_custom.scss:348 DEBUG: $input-padding-y `0.5rem`
src/scss/_custom.scss:346 DEBUG: $font-size-base `13px`
src/scss/_custom.scss:348 DEBUG: $input-padding-y `0.5rem`
The issue seems to stem from conflicting values in imported files:
@import "variables" // $font-size-base: 13px;
@import "custom" // $font-size-base: 1rem !default;
This raises questions about how a variable can hold different values simultaneously and ensuring proper override order.
Further context reveals the specific error related to incompatible units at line 350 of the custom scss file:
Error: src/scss/_custom.scss
Error: Incompatible units: 'rem' and 'px'.
on line 350 of src/scss/_custom.scss
>> $input-height: (($font-size-base * $line-height-base) + ($in
-----------------------------------^
The problematic line in question is:
$input-height:(($font-size-base * $line-height-base) + ($input-padding-y * 2)) !default;
Through @debug of $line-height-base
, it's revealed that the value is set to `1.42857`.