Skip to content

Instantly share code, notes, and snippets.

@coltpini
Last active August 7, 2016 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coltpini/e25b2e26e9f2032563ac098fe44668ac to your computer and use it in GitHub Desktop.
Save coltpini/e25b2e26e9f2032563ac098fe44668ac to your computer and use it in GitHub Desktop.
$grid__column-width: (
'300': $grid__column-width--300,
'400': $grid__column-width--400,
'500': $grid__column-width--500,
'600': $grid__column-width--600,
'700': $grid__column-width--700
);
$grid__gutter-width: (
'300': $grid__gutter-width--300,
'400': $grid__gutter-width--400,
'500': $grid__gutter-width--500,
'600': $grid__gutter-width--600,
'700': $grid__gutter-width--700
);
// FUNCTIONS
@function grid-columns($numberOfColumns, $size, $extraGutter: false){ // extraGutter adds back in a gutter that we normally remove so that content doesn't go into the gutter space. Normally this will be for when this is used as a margin/padding.
$columnWidth : map-get($grid__column-width, $size+"");
$gutterWidth : map-get($grid__gutter-width, $size+"");
@if $extraGutter {
@return ($columnWidth * $numberOfColumns);
}
@else {
@return ($columnWidth * $numberOfColumns) - $gutterWidth;
}
}
@function grid-gutter($size, $toEdge: false){
$gutter-width : map-get($grid__gutter-width, $size+"");
@if $toEdge {
@return $gutter-width + ($gutter-width/2);
}
@else {
@return $gutter-width;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment