Created
February 5, 2014 05:31
-
-
Save metaskills/8817909 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.3.0.rc.2) | |
// Compass (v1.0.0.alpha.17) | |
// ---- | |
// Simple String Substitute | |
@function sub($string, $replace, $value) { | |
$replace-len: str-length($replace); | |
$replace-start: str-index($string, $replace); | |
$string-len: str-length($string); | |
$string-left: str-slice($string, 1, $replace-start - 1); | |
$string-right: str-slice($string, $replace-start + $replace-len); | |
@return #{$string-left}#{$value}#{$string-right}; | |
} | |
// Template Parser | |
@function parse-template($template, $value) { | |
@return sub($template, 'VALUE', $value); | |
} | |
$my-color-names: ( 'inchworm', 'sunglow', 'scarlet'); | |
$my-colors: ( #a5de37, #ffd426, #ff4351 ); | |
@each $name in $my-color-names { | |
$index: index($my-color-names, $name); | |
$color: nth($my-colors, $index); | |
%my-#{$name}-background-color { background-color: $color; } | |
%my-#{$name}-border-color { border-color: $color; } | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment