Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJames Home
12,011 PointsIs this nested loop using Susy grid and sass efficient?
I wanted to produce all fractions up to 12, e.g. 1/2, 1/4, 1/12. This does the job as far as I can tell but I do not think with the nested loop it is as efficient or clean as it should be. Any thoughts on improvement?
.grid {
// use interpolation to produce correct classes
// get 1 to susy grid columns via susy (map)
@for $i from 1 through map-get($susy, columns) {
// nest loop, loop backwards
@for $n from map-get($susy, columns) through $i {
&-#{$i}-#{$n} {
@include span($i of $n);
// @each media query
@each $mqs, $size in $mqs {
@include mq(#{$size}) {
&-#{$mqs} {
@include span($i of $n);
}
}
}
}
}
}
}