Skip to content

Instantly share code, notes, and snippets.

@Komock
Created April 18, 2019 11:01
Show Gist options
  • Save Komock/62d91616bddb722ab829bba7b088542c to your computer and use it in GitHub Desktop.
Save Komock/62d91616bddb722ab829bba7b088542c to your computer and use it in GitHub Desktop.
Simple SCSS Columns Grid Mixin
@mixin gridColumnSizes($params) {
$defaults: (
suffix: '',
base: ''
);
$opts: map-merge($defaults, $params);
$base: map-get($opts, 'base');
$suffix: map-get($opts, 'suffix');
$bs: if($base == '', '', $base + '__');
$sf: if($suffix == '', '_', '_' + $suffix + '-');
$col: (100% / 12);
#{$bs}col#{$sf} {
@for $i from 1 through 12 {
&#{$i}-12 { width: $col * $i; }
}
}
}
@include gridColumnSizes((base: '.some'));
@include gridColumnSizes((base: '.some', suffix: 'md'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment