My attempt to use SASS properties as arguments for my function seems to be failing miserably.
Is there a way I can achieve this, or is there a better solution to what I'm trying to do?
I am looking to dynamically change the values of variables based on screen width media queries within my function.
Currently:
@function myFunc($arg1, $arg2) {
@debug "arg1 = #{$arg1} / arg2 = #{$arg2}";
@return #{$arg1} * #{$arg2};
}
.my-class {
// Initial values for mobile
--var1: 10px;
--var2: 20px;
@media (--from-tablet-size) {
--var1: 20px;
--var2: 40px;
}
width: myFunc(--var1, ---var2);
}
The debug output shows that the function receives the strings --var1
and --var2
instead of their actual values...
DEBUG: arg1 = --var1 / arg2 = --var2
Is there a solution to this issue? Either by using properties as arguments like I am trying here, or through a different approach?