Created
May 4, 2012 00:40
-
-
Save barraponto/2590728 to your computer and use it in GitHub Desktop.
Dynamic Mixins in SCSS
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
| .span4 { | |
| width: 400px; } | |
| .span3 { | |
| width: 300px; } | |
| .span2 { | |
| width: 200px; } | |
| .span1 { | |
| width: 100px; } |
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
| @mixin spanx($index) { | |
| @if (typeof($index) == 'number') { | |
| @while $index > 0 { | |
| .span#{$index} { | |
| width: $index * 100px; } | |
| $index: $index - 1; } } | |
| @else { | |
| @warn "spanx mixin was called with a #{typeof($index)} argument"; } } | |
| @include spanx(4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment