So in my project I have included Sass styles from a third party library (trough node modules). Normally nobody touches such code as it is subject to updates etc. However the design from artist requires to apply class x
styles when its desktop and y
class styles when its mobile to same element. I tried something like:
.z {
@extend .x;
}
@include media-breakpoint-down(sm) {
.z {
@extend .y;
}
}
But SASS doesn't allow this. You may not @extend an outer selector from within @media
.
Another way is to duplicate the element. One has class x
another y
. And then show/hide them according to screen size, but that's bad for SEO and also code looks ugly.
I wonder if there is a graceful solution to this problem!?