Skip to content

Commit

Permalink
Add sass util mixin to support selector qualification
Browse files Browse the repository at this point in the history
That is, qualify a current selector with a tag. This is
because the syntax to do this in SASS is horrible
  • Loading branch information
ediblecode committed Jun 14, 2018
1 parent f8f03fa commit f4998d3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/stylesheets/helpers/_helpers-utils.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,15 @@
@return $rem-vals;
}
}

/// Since the current way to qualify a class from within its ruleset is quite
/// ugly, here is a mixin providing a friendly API to do so.
/// @see https://css-tricks.com/snippets/sass/mixin-to-qualify-a-selector/
/// @author Hugo Giraudel
/// @param {String} $element-selector - Element selector
/// @since 0.5.0;
@mixin when-is($element-selector) {
@at-root #{$element-selector + &} {
@content;
}
}

0 comments on commit f4998d3

Please sign in to comment.