Not sure what issue you had, but the very same code from OP just worked for me on the site linked in the other comment...
this post was submitted on 16 Aug 2023
2 points (100.0% liked)
CSS
542 readers
1 users here now
founded 2 years ago
MODERATORS
Yes, I should have shown the real @for loop, because in my case the loop number is unknown (it's a variable), so the compiler has trouble compiling it.
I didn't post this is in the right place. I basically need JavaScript code to replicate this SCSS loop in a way that I can loop though this element with an unknown number of times (a variable that can change according to an array.length for instance).
How are you compiling?
Basically I entered all my scss code in this site : https://wtools.io/convert-scss-to-css
I just did a really silly loop (I'm on my phone) and it seemed to work.
@for $t from 1 through 2 {
.a-#{$t} {
color: red;
}
}