I am migrating an electron app into a web-browser app and I have come across some scss styling I have never seen before. Most of the selector use an At-Rule that does not make any sense.
It seems to generate class names but I am struggling to understand whether is a SASS features or some other library\package.
all these @b, @m don't make any sense to me.
I have googled but could not find better info neither on SCSS docs.
/* Text inputs */
@b textInput {
@include inputBoxStyle;
@m small, s {
padding: 0.5rem;
border-radius: 3px;
}
@m large, l {
padding: 1rem;
font-size: 1.2rem;
border-width: 2px;
border-radius: 5px;
}
@m textOnly {
background-color: transparent;
border: none;
padding: 0 !important;
}
@m invalid, invalid:focus {
border-color: $pastelPink;
}
@e hiddenInteraction:not(:hover):not(:focus):not(:active) {
@include inputHiddenInteraction;
}
}
/* Selects */
@b select {
position: relative;
select {
@include inputBoxStyle;
padding-right: 1.6rem;
appearance: none;
}
&:after {
position: absolute;
top: calc(50% - (1em / 2));
right: 1rem;
font-family: 'FontAwesome', serif;
font-size: 1rem;
line-height: 1em;
content: '\f078';
color: $ourWhite;
pointer-events: none;
}
Thanks to the help of another developer I was able to figure out that this syntax is part of the package: https://www.npmjs.com/package/postcss-atrule-bem
Using the same SASS nesting adopted by the npm package, you can find and replace in your IDE the @b block with .block, @e element with &__element and @m modifier with &--modifier.