Adding two values in Sass function creates double instance of ‘px’

Your function is returning a string, not a number. Sass assumes that you want to concatenate them because that’s all it can do with a string and any other type.

@function stripAndPx($in){
  $stripped: $in / ($in * 0 + 1); //strip unit
  @return (($stripped) * 16) * 1px; //convert to px
}

Leave a Comment