I need to convert numbers into words, so:
- "1-3" -> "one-third"
- "3-3" -> "three-thirds"
- "2-5" -> "two-fifths"
The numbers are generated in a loop, which should output a bunch of different class names like one-third
or one-half
:
$number = 3;
@for $i from 1 through $number-1 {
// some calculations to output those classes: ".one-third", ".two-thirds"
// The following currently outputs class names like ".1-3" and ".2-3"
.#{$i}-#{$number} {
// CSS styles
}
}
I think I need to use two different associative arrays, which in PHP (just as an example) might look like:
$1 = array(
"1"=>"one",
"2"=>"two",
"3"=>"three"
);
$2 = array(
"1"=>"whole",
"2"=>"half",
"3"=>"third"
);
Is it possible in SASS/SCSS to create associative arrays at all or is there any workaround?
question from:https://stackoverflow.com/questions/21344891/associative-array-scss-sass