Skip to content

Instantly share code, notes, and snippets.

@barraponto
Created May 4, 2012 00:40
Show Gist options
  • Select an option

  • Save barraponto/2590728 to your computer and use it in GitHub Desktop.

Select an option

Save barraponto/2590728 to your computer and use it in GitHub Desktop.
Dynamic Mixins in SCSS
.span4 {
width: 400px; }
.span3 {
width: 300px; }
.span2 {
width: 200px; }
.span1 {
width: 100px; }
@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