I’m just trying to work out if something is possible or not with SCSS.
Please feel free to ask me for more details if I’m not very clear in what I’m asking, but here’s what I’m trying to achieve.
Pseudo code:
.class1 { width:100px; }
.class2 { margin-right:[.class1{width}] + 2 }
compiling into
.class1 {width:100px; }
.class2 { margin-right:102px; }
I believe to get what you want, a variable is best used:
Update (based on comment info)
You might add a global variable below
$ColCountthat begins as an empty list, like so:Then inside
@mixin columns($numCols)after$colWidthis calculated, add thewidthvalue for that column to the$WidthListby adding this function:Then, once all the columns have calculated, you should have a list containing all the
widthvalues, so that you can access them if you desire elsewhere, and thus……should yield the
.cl-col5value you want for themargin.Note that I did not test this. Nor have I actually ever used SASS. I am basing this strictly off the documentation found here and elsewhere on their site.