Reputation: 73
Does anyone know how the header component sass placeholder tag is processed in Spartacus?
%header {
background-color: var(--cx-color-dark);
color: var(--cx-color-inverse);
display: block;
It’s just a placeholder, but it works like a header element selector. I couldn’t find any extension for this
Upvotes: 0
Views: 192
Reputation: 581
The header placeholder is placed in an array of layout placeholders in the index.scss
file for the layout folder.
$layout-components-whitelist: cx-storefront, header, cx-site-context-selector,
cx-skip-link !default;
This scss array is imported in _component.scss
which you can see here _component.scss. This file has a loop that will dynamically extend the placeholders for all of the default Spartacus styles.
@each $selector in $selectors {
#{$selector} {
// skip selectors if they're added to the $skipComponentStyles list
@if (index($skipComponentStyles, $selector) == null) {
@extend %#{$selector} !optional;
// optional theme specific placeholder
@extend %#{$selector}-#{$theme} !optional;
}
}
}
Upvotes: 2
Reputation: 146
The extension of this placeholder is done dynamically - here in line 42: https://github.com/SAP/cloud-commerce-spartacus-storefront/blob/f3c81d4bb04f8c222fc73d3ca1ea099783e1a82f/projects/storefrontstyles/scss/_components.scss
It's done this way to allow developers to skip the styling of specific components. Here you can read more about this: https://sap.github.io/cloud-commerce-spartacus-storefront-docs/css-architecture/#skipping-specific-component-styles
Upvotes: 3