Вы можете рассмотреть возможность использования карт, например:
// _brands.scss
$brand-1: red;
$brand-2: green;
$brand-3: orange;
$brand-4: blue;
$brand-1-gradient: linear-gradient(to top, red, red);
$brand-2-gradient: linear-gradient(to top, green, green);
$brand-3-gradient: linear-gradient(to top, orange, orange);
$brand-4-gradient: linear-gradient(to top, blue, blue);
$brands: (
brand-1 : (
// note! you can add more properties to each style map
'.example-1, .example-2': (background: $brand-1, color: magenta ),
'.example-3, .example-4': (background: $brand-1-gradient ),
'.example-5, .example-6': (background: rgba($brand-1, 0.8) ),
'.example-7, .example-8': (border-color: $brand-1 ),
'.example-9, .example-10': (color: $brand-1 )
),
brand-2 : (
'.example-1, .example-2': (background: $brand-2 ),
'.example-3, .example-4': (background: $brand-2-gradient ),
'.example-5, .example-6': (background: rgba($brand-2, 0.8) ),
'.example-7, .example-8': (border-color: $brand-2 ),
'.example-9, .example-10': (color: $brand-2 )
),
brand-3 : (
'.example-1, .example-2': (background: $brand-3 ),
'.example-3, .example-4': (background: $brand-4-gradient ),
'.example-5, .example-6': (background: rgba($brand-3, 0.8) ),
'.example-7, .example-8': (border-color: $brand-3 ),
'.example-9, .example-10': (color: $brand-3 )
),
brand-4 : (
'.example-1, .example-2': (background: $brand-4 ),
'.example-3, .example-4': (background: $brand-4-gradient ),
'.example-5, .example-6': (background: rgba($brand-4, 0.8) ),
'.example-7, .example-8': (border-color: $brand-4 ),
'.example-9, .example-10': (color: $brand-4 )
)
);
// brands.scss
@import '_brands.scss'
body {
@each $brand, $selectors in $brands {
@at-root #{&}.#{$brand} {
@each $selector, $style in $selectors {
#{$selector}{
@each $property, $value in $style {
#{$property}: $value;
}
}
}
}
}
}
Вы также можете разделить каждый бренд на отдельные таблицы стилей, используя миксин
// add to _brand.scss
@mixin brand($brand-name) {
body {
@at-root #{&}.#{$brand-name} {
@each $selector, $style in map-get($brands, $brand-name) {
#{$selector}{
@each $property, $value in $style {
#{$property}: $value;
}
}
}
}
}
}
// brand1.scss
@import '_brands.scss';
@include brand(brand-1);
// brand2.scss
@import '_brands.scss';
@include brand(brand-2);
// brand3.scss
@import '_brands.scss';
@include brand(brand-3);
// brand4.scss
@import '_brands.scss';
@include brand(brand-4);