Last active
August 29, 2015 14:27
-
-
Save Jamesyps/1878533f23e5a05c6eec 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
// ---- | |
// Sass (v3.4.14) | |
// Compass (v1.0.3) | |
// ---- | |
@mixin v-spacing($margin: 30px, $padding: 0) { | |
$selector-chain: &; | |
$top-level-selector: false; | |
@each $selector in $selector-chain { | |
$top-level-selector: nth($selector, length($selector)) | |
} | |
@if($top-level-selector) { | |
+ #{$top-level-selector} { | |
margin-top: $margin; | |
padding-top: $padding; | |
@content; | |
} | |
} | |
@else { | |
@error "mixin cannot be called in root document"; | |
} | |
} | |
.toggle-list { | |
@include v-spacing(30px); | |
.toggle { | |
@include v-spacing(30px); | |
} | |
.test .foo .bar { | |
@include v-spacing(30px); | |
} | |
} |
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
.toggle-list + .toggle-list { | |
margin-top: 30px; | |
padding-top: 0; | |
} | |
.toggle-list .toggle + .toggle { | |
margin-top: 30px; | |
padding-top: 0; | |
} | |
.toggle-list .test .foo .bar + .bar { | |
margin-top: 30px; | |
padding-top: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment