Created
September 19, 2015 17:13
-
-
Save lunelson/75f3da337da96eca8158 to your computer and use it in GitHub Desktop.
minimal test for self-extending mixin pattern
This file contains hidden or 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) | |
| // 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); | |
| } | |
This file contains hidden or 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
| .test, .test2, .test3 { | |
| margin: 2em; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment