I am encountering an issue with whitespace being added to the CSS after compiling a *.scss file in my Angular 7 project. This unwanted whitespace is causing incorrect results in the UI.
To replicate the problem, you can visit...
...and copy and paste the code snippet provided below:
$color-background-default: white;
$color-foreground-default: black;
$color-background-disabled: #d3d3d3;
$color-foreground-disabled: #808080;
$color-background-mouseover: #00a7dc;
$color-foreground-mouseover: white;
$color-background-mousedown: #00467F;
$color-foreground-mousedown: white;
.Tab
{
background-color: $color-background-default;
color: $color-foreground-default;
:hover
{
background-color: $color-background-mouseover;
color: $color-foreground-mouseover;
}
:active
{
background-color: $color-background-mousedown;
color: $color-foreground-mousedown;
border-color: $color-background-mousedown;
}
}
In the CSS box of Sassmeister, you may notice that there are unnecessary whitespaces between ".Tab" and ":hover", as well as ".Tab" and ":active".
Removing these whitespaces will result in the correct UI display:
.Tab {
background-color: white;
color: black;
}
.Tab:hover {
background-color: #00a7dc;
color: white;
}
.Tab:active {
background-color: #00467F;
color: white;
border-color: #00467F;
}
The second option without whitespaces provides the desired UI outcome.
My question is: How can I prevent these whitespace issues in Angular 7?