Created
April 18, 2019 11:01
-
-
Save Komock/62d91616bddb722ab829bba7b088542c to your computer and use it in GitHub Desktop.
Simple SCSS Columns Grid Mixin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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