Skip to content

Instantly share code, notes, and snippets.

@csswizardry
Last active November 12, 2015 21:29
Show Gist options
  • Save csswizardry/66cc5e6dbceef5de3e4c to your computer and use it in GitHub Desktop.
Save csswizardry/66cc5e6dbceef5de3e4c to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<p class="foo--bar">Lorem ipsum dolor sit amet.</p>
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
// Make sure we have a way to turn debugging on/off.
$debug: true;
@if ($debug == true) {
/**
* If an element has a class attribute containing two hyphens but no space
* (i.e. only one class is being used, and it’s a Modifier), provide visual
* feedback in the DOM.
*
* N.B. This isn’t bulletproof: `class="foo--bar baz"` would pass, as would
* `class=" foo--bar"`. Use with a pinch of salt.
*/
[class*="--"]:not([class*=" "]) {
position: relative;
outline: 1px solid red;
&:after {
content: "ERROR: Cannot have a Modifier (i.e. `." attr(class) "`) without a Block.";
position: absolute;
bottom: 100%;
left: 0;
font-family: monospace;
white-space: nowrap;
background-color: white;
color: red;
}
}
}
@charset "UTF-8";
/**
* If an element has a class attribute containing two hyphens but no space
* (i.e. only one class is being used, and it’s a Modifier), provide visual
* feedback in the DOM.
*
* N.B. This isn’t bulletproof: `class="foo--bar baz"` would pass, as would
* `class=" foo--bar"`. Use with a pinch of salt.
*/
[class*="--"]:not([class*=" "]) {
position: relative;
outline: 1px solid red;
}
[class*="--"]:not([class*=" "]):after {
content: "ERROR: Cannot have a Modifier (i.e. `." attr(class) "`) without a Block.";
position: absolute;
bottom: 100%;
left: 0;
font-family: monospace;
white-space: nowrap;
background-color: white;
color: red;
}
<p class="foo--bar">Lorem ipsum dolor sit amet.</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment