I'm fairly new to theming, I'm mainly a backend developer.
Currently, I'm trying to customize CSS properties/classes from an external file, but because of angular's encapsulation, it's not working.
With the default, emulated, encapsulation my .btn
class is displayed like this:
Using ViewEncapsulation.None
, I get the desired behavior:
In my component's SCSS file, I import the external SCSS file and customize some properties:
@import "@scope/theming/assets/core";
.btn {
--#{$prefix}btn-bg: var(--#{$prefix}bg-surface);
display: inline-flex;
align-items: center;
justify-content: center;
white-space: nowrap;
...
}
The @scope/theming/assets/core
SCSS file imports the SCSS from bootstrap and other files. I thought that by importing the SCSS file directly in the component, the style would be correctly applied, but that's not the case.
As far as I understand, changing encapsulation to None is not the "best" solution. If that's the case, is there a better solution for what I'm trying to do? I've read about a lot things, including mixins, but I'm not quite sure how they'd fit in my scenario.
Note: This is an angular library.