Replace @while loops with @for loops

This makes the code shorter and easier to read. In addition, it makes it
compile successfully with pyScss, which doesn't support @while loops.