Skip to content

Instantly share code, notes, and snippets.

@lunelson
Created September 19, 2015 17:13
Show Gist options
  • Select an option

  • Save lunelson/75f3da337da96eca8158 to your computer and use it in GitHub Desktop.

Select an option

Save lunelson/75f3da337da96eca8158 to your computer and use it in GitHub Desktop.
minimal test for self-extending mixin pattern
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// sass-maps-plus (ve4d32a1dc2)
// ----
@import "sass-maps-plus";
$mixins: ();
@mixin margin($arg: 0) {
$id: get($mixins, 'margin', $arg);
@if not $id {
$id: unique-id();
$mixins: merge($mixins, 'margin', $arg, $id) !global;
@at-root %#{$id} {
margin: $arg + em;
}
}
@extend %#{$id};
}
// TESTS
.test {
@include margin(2);
}
.test2 {
@include margin(2);
}
.test3 {
@include margin(2);
}
.test, .test2, .test3 {
margin: 2em;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment