I'm trying to create a bunch of columns for a grid layout, and wondering if I can automate the width calculations with a SASS/SCSS mixin.
I'm currently writing
@mixin setWidth($a, $b){
width : ($a / $b)*100%;
}
.col-1-2{
@include setWidth(1, 2);
}
That's fine, but I'm just wondering if there's a way to make it even more DRY, by setting the class with a variable name and creating the class with a mixin.
Something like
@mixin setClass($a, $b){
.col-$a-$b{
width : ($a / $b)*100%;
}
}
@include setClass(1, 2);