Last active
November 13, 2015 02:59
-
-
Save csswizardry/f75bdb4458d69f3ea8a6 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1 class="foo">Lorem ipsum dolor sit amet.</h1> | |
<p class="error">Lorem ipsum dolor sit amet.</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.14) | |
// Compass (v1.0.3) | |
// ---- | |
// Make sure we have a way to turn debugging on/off. | |
$debug: true; | |
@if ($debug == true) { | |
// List of selectors that we’re deprecating (and their replacements, if any). | |
$deprecated-selectors: ( | |
'.foo': null, | |
'.error': '.c-message .c-message--error' | |
); | |
// Create a placeholder to DRY out any of our shared styles. | |
%deprecated-selectors-shared-styles { | |
position: relative; | |
outline: 1px solid orange; | |
&:after { | |
position: absolute; | |
bottom: 100%; | |
left: 0; | |
font: normal 12px/1 monospace; | |
white-space: nowrap; | |
background-color: white; | |
color: orange; | |
} | |
} | |
@each $selector, $replacement in $deprecated-selectors { | |
#{$selector} { | |
// Share the cosmetic styles rather than repeat them per selector. | |
@extend %deprecated-selectors-shared-styles; | |
&:after { | |
@if ($replacement != null) { | |
/** | |
* If we have a replacement selector, tell people what it is. | |
*/ | |
content: "WARN: Selector `#{$selector}` is deprecated, use `#{$replacement}` instead."; | |
} @else { | |
/** | |
* If we have no replacement, just tell people to stop using the | |
* selector. | |
*/ | |
content: "WARN: Selector `#{$selector}` is deprecated."; | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.foo, .error { | |
position: relative; | |
outline: 1px solid orange; | |
} | |
.foo:after, .error:after { | |
position: absolute; | |
bottom: 100%; | |
left: 0; | |
font: normal 12px/1 monospace; | |
white-space: nowrap; | |
background-color: white; | |
color: orange; | |
} | |
.foo:after { | |
/** | |
* If we have no replacement, just tell people to stop using the | |
* selector. | |
*/ | |
content: "WARN: Selector `.foo` is deprecated."; | |
} | |
.error:after { | |
/** | |
* If we have a replacement selector, tell people what it is. | |
*/ | |
content: "WARN: Selector `.error` is deprecated, use `.c-message .c-message--error` instead."; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1 class="foo">Lorem ipsum dolor sit amet.</h1> | |
<p class="error">Lorem ipsum dolor sit amet.</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment