Created
June 17, 2011 14:43
-
-
Save StanAngeloff/1031551 to your computer and use it in GitHub Desktop.
Re-usable logic
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
html { | |
@for $index from 1 through length($base-colors) { | |
$base-color: nth($base-colors, $index); | |
&.ui-theme-#{letter($index)} { | |
background-color: $base-color; | |
} | |
} | |
} |
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 for-each($block) { | |
@for $index from 1 through length($base-colors) { | |
$base-color: nth($base-colors, $index); | |
@eval $block, $index: $index, $base-color: $base-color, $letter: letter($index) | |
} | |
} | |
html { | |
@include for-each({ | $index, $base-color, $letter | | |
&.ui-theme-#{$letter} { | |
background-color: $base-color; | |
} | |
}); | |
} | |
// -- OR (preferred, functions are just objects) -- | |
html { | |
@include for-each(@function($index, $base-color, $letter) { | |
&.ui-theme-#{$letter} { | |
background-color: $base-color; | |
} | |
}); | |
} | |
// -- OR (implicit block, all arguments are available) -- | |
html { | |
@include for-each({ | |
&.ui-theme-#{$letter} { | |
background-color: $base-color; | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment