I have a custom function in Sass that takes an em value, strips the unit and creates a px value:
@function stripAndPx($in){
$stripped: $in / ($in * 0 + 1); //strip unit
@return #{ (($stripped) * 16) + 'px'}; //convert to px
}
I am then attempting to take an em variable:
$em-variable: 1em;
And add it to a pixel-based variable:
$px-variable: 20px;
Example:
right: $px-variable + (stripAndPx($em-variable));
Which creates this output:
right: 20px16px;
I am expecting both values to be added:
right: 36px;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…