If you want to use variables as property names you need to use string interpolation – #{$var}
.
So this should work:
[class*="shift"] {
$sft-o: 10px;
@mixin shift_stp($val) {
&[class*="_sml"]{ #{$val}: $sft-o; }
&[class*="_mid"]{ #{$val}: $sft-o * 2; }
&[class*="_big"]{ #{$val}: $sft-o * 3; }
}
&[class*="_m"]{
@include shift_stp(margin);
}
&[class*="_p"]{
@include shift_stp(padding);
}
}
DEMO
Just a note: for your attribute selectors … *="_m"
will also apply to the ones that have _mid
in them (see here) … so maybe you should rethink this a little.