SCSS Mixin


/* at-root, but replace some part of the selector */
@mixin whenroot($selectorreplaced, $selectorreplacement) {
    @at-root #{selector-replace(
        &,
        $selectorreplaced,
        $selectorreplacement
    )} {
        @content;
    }
}
usages:
.a {
  .b {
     .c {
         @include whenroot(.a, .a.hasthisclass) {
            display: none
         }
      }
  }
}