Skip to content

Instantly share code, notes, and snippets.

@Erbenos
Last active May 17, 2017 23:40
Show Gist options
  • Select an option

  • Save Erbenos/dcd3b22ad1678e37cb0f7128144957d7 to your computer and use it in GitHub Desktop.

Select an option

Save Erbenos/dcd3b22ad1678e37cb0f7128144957d7 to your computer and use it in GitHub Desktop.
Simple SASS Grid (jeet.gs dependency)
$grid-ns : "" !default;
$columns : 12 !default;
$row-max-width : 1200 !default;
$row-hspace : 12 !default;
$mobile-first-shorthand : "mf" !default;
$desktop-first-shorthand : "df" !default;
$gutter : 4.5;
$breakpoints: (
// Used to generate mobile-first base, from our non-mobile-first vars
base: (
size: 0,
shorthand: bs,
),
mobile-portrait: (
size: 320,
shorthand: m_p,
),
mobile-landscape: (
size: 480,
shorthand: m_l,
),
tablet-portrait: (
size: 768,
shorthand: t_p,
),
tablet-landscape: (
size: 1024,
shorthand: t_l,
),
laptop: (
size: 1280,
shorthand: lp,
),
wide-laptop: (
size: 1600,
shorthand: wl,
),
hi-res-screen: (
size: 1920,
shorthand: hrs,
)
) !default;
.c-row {
@include center(#{$row-max-width}px, #{$row-hspace}px);
}
.u-cf {
@include cf();
}
@each $breakpoint, $breakpoint-info in $breakpoints {
@media screen and (min-width: #{map-get($breakpoint-info, size)}px) {
@for $i from 1 through $columns {
.#{$grid-ns}o-#{$mobile-first-shorthand}-#{$i}\/#{$columns}\@#{map-get($breakpoint-info, shorthand)} {
@include col($i/$columns, $gutter: $gutter);
}
}
}
@media screen and (max-width: #{map-get($breakpoint-info, size) - 1}px) {
@for $i from 1 through $columns {
.#{$grid-ns}o-#{$desktop-first-shorthand}-#{$i}\/#{$columns}\@#{map-get($breakpoint-info, shorthand)} {
@include col($i/$columns, $gutter: $gutter);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment