css - A reverse look up sass mixin, is this possible? -
does know if following possible sass
i have ie mixin:
@mixin ie($version) { @if $version == 8 { html.lt-ie9 { @content; } } @if $version == 7 { html.lt-ie8 { @content; } } }
usage:
@include ie(8){ body { header { color: beige; } } }
renders:
html.lt-ie9 body header { color: beige; }
now awesome if this:
header { > nav { color: beige; @include ie(8) { color: green; } } }
which render
header > nav { color: beige; } html.lt-ie9 header > nav { color: green; }
this might wishful thinking, has got ideas if possible
[edit]
so it's possible! super.
i've update mixin to:
@mixin ie($version,$depth:false) { @if $depth == false { @if $version == 8 { html.lt-ie9 { @content; } } @if $version == 7 { html.lt-ie8 { @content; } } } @else { @if $version == 8 { html.lt-ie9 & { @content; } } @if $version == 7 { html.lt-ie8 & { @content; } } } }
thanks dave
you don't need mixin. use:
header { > nav { color: beige; html.lt-ie9 & { color: green; } } }
Comments
Post a Comment