From f693a926d657370695f7aeed1a29194938f39b90 Mon Sep 17 00:00:00 2001 From: Pedro Reis Date: Thu, 11 Sep 2014 14:57:51 +0100 Subject: [PATCH] Update _grid.scss --- scss/base/_grid.scss | 49 ++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/scss/base/_grid.scss b/scss/base/_grid.scss index 546f9e5..964e9c9 100644 --- a/scss/base/_grid.scss +++ b/scss/base/_grid.scss @@ -18,25 +18,38 @@ padding-left: $gutter; } -@each $breakpoint in $breakpoints-list { - $name: nth($breakpoint, 1); - $declaration: nth($breakpoint, 2); - @media only screen and #{$declaration}{ - @if $name == sd { - .col .col { - margin-bottom: $gutter; - &:last-child { - margin-bottom: 0; - } - } +@mixin grid-loop($name){ + @for $i from 1 through $grid-columns { + .col--#{$name}-#{$i} { + width: percentage($i/$grid-columns); } - @for $i from 1 through $grid-columns { - .col--#{$name}-#{$i} { - width: percentage($i/$grid-columns); - } - .col--#{$name}-offset-#{$i} { - margin-left: percentage($i/$grid-columns); - } + .col--#{$name}-offset-#{$i} { + margin-left: percentage($i/$grid-columns); } } } + +@each $breakpoint in $breakpoints-list { + + $name: nth($breakpoint, 1); + $declaration: nth($breakpoint, 2); + + @if $name == ld { + @include grid-loop($name); + } + + @else { + @media only screen and #{$declaration} { + @if $name == sd { + .col .col { + margin-bottom: $gutter; + &:last-child { + margin-bottom: 0; + } + } + } + @include grid-loop($name); + } + } + +}