kuatsure/helpful-helpers

View on GitHub
mixins/_attention.scss

Summary

Maintainability
Test Coverage
$hh-default-attentions: '.active', ':active', ':focus', ':hover' !default;

// USAGE:
//
// a {
//   @include attention {
//     color: red;
//   }
// }
//
// b {
//   @include attention( ( '.alpha', '.beta' ) )  {
//     color: blue;
//   }
// }
//
// $default-attentions: '.hi', '.there';
// c {
//   @include attention {
//     color: green;
//   }
// }
//
// COMPILED:
//
// a.active, a:active, a:focus, a:hover {
//   color: red;
// }
//
// b.alpha, b.beta {
//   color: blue;
// }
//
// c.hi, c.there {
//   color: green;
// }


@mixin attention( $classes: $hh-default-attentions ) {
  $selector: ( );

  @each $c in $classes {
    $selector: append( $selector, unquote( '&#{$c}' ), 'comma' );
  }

  #{$selector} {
    @content;
  }
}