Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SASS error: Incompatible units: 'px' and 'px*px'

I'm using SCSS to change the style of bootstrap 4 to create my own style, but when I compile my SCSS I get this error:

{
  "status": 1,
  "file": "H:/!WEBSITE/modules/The Force - Bootstrap/content/scss/variables/variables.scss",
  "line": 330,
  "column": 34,
  "message": "Incompatible units: 'px' and 'px*px'.",
  "formatted": 
     "Error: Incompatible units: 'px' and 'px*px'. 
        on line 330 of scss/variables/variables.scss
        >> $input-height: (($font-size-base * $input-line-height) + ($input-padding-y * 2)) !default;"
}


My variables value:

$font-size-base:          14px !default;
$line-height-base:        1.846 !default;
$input-line-height:       floor(($font-size-base * $line-height-base)) !default;
$input-padding-y:         6px !default;


The line that pops the error:

$input-height: (($font-size-base * $input-line-height) + ($input-padding-y * 2)) !default;


I don't understand why it is not working and I understand even less how to fix it. I compile SCSS with node-sass and I don't think the problem comes from node-sass because it's not the first time I use it and I've been using it all day long without getting any error of that kind.

like image 990
Elie G. Avatar asked Mar 14 '17 22:03

Elie G.


1 Answers

Your issue is that you are multiplying px with px, resulting in px2

So remove px from variable $font-size-base

$font-size-base:          14 !default;
$line-height-base:        1.846 !default;
$input-line-height:       floor(($font-size-base * $line-height-base)) !default;
$input-padding-y:         6px !default;
$input-height: (($font-size-base * $input-line-height) + ($input-padding-y * 2)) !default;

More Info about Sass units here

like image 111
dippas Avatar answered Sep 18 '22 08:09

dippas