Skip to content

Instantly share code, notes, and snippets.

@bleuebuzz
Created September 26, 2014 10:20
Show Gist options
  • Save bleuebuzz/686fe4d92ab389095c86 to your computer and use it in GitHub Desktop.
Save bleuebuzz/686fe4d92ab389095c86 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
$fucking-crazy-selectors: ()!default;
@mixin selector-set ($name, $selector) {
$fucking-crazy-selectors: map-merge($fucking-crazy-selectors, ($name: $selector))!global;
}
@function selector-get ($name, $placeholder: null) {
@each $key, $selector in $fucking-crazy-selectors {
@if $name == $key {
@return $selector;
}
}
@return $placeholder;
}
@mixin selector ($name, $placeholder: null) {
$_selector: selector-get($name, $placeholder);
@if $_selector {
/* selector for: `#{$name}` */
#{$_selector} {
@content;
}
}
}
@include selector-set('foo', '#foo test');
@include selector-set('bar', '#bar test2 li');
@include selector(foo) {
foo: selector-get('foo');
get: selector-get('get'); // null
bar: selector-get('bar');
}
/* selector for: `foo` */
#foo test {
foo: "#foo test";
bar: "#bar test2 li";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment