Skip to content

Instantly share code, notes, and snippets.

@ffoodd
Created May 20, 2021 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ffoodd/a26bcc11efaab95ad77ace47030129dd to your computer and use it in GitHub Desktop.
Save ffoodd/a26bcc11efaab95ad77ace47030129dd to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
@function add($value1, $value2, $return-calc: true) {
@if $value1 == null {
@return $value2;
}
@if $value2 == null {
@return $value1;
}
@if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
@return $value1 + $value2;
}
@if type-of($value1) != number {
$value1: unquote("(") + $value1 + unquote(")");
}
@if type-of($value2) != number {
$value2: unquote("(") + $value2 + unquote(")");
}
@if $return-calc == true {
@return calc(#{$value1} + #{$value2});
}
@return $value1 + unquote(" + ") + $value2;
}
$value: add(1rem, 1em, false);
a {
font-size: add(1vw, $value);
type: type-of($value);
}
b {
font-size: add(1rem, 1em);
}
a {
font-size: calc(1vw + (1rem + 1em));
type: string;
}
b {
font-size: calc(1rem + 1em);
}
{
"sass": {
"compiler": "dart-sass/1.32.12",
"extensions": {},
"syntax": "SCSS",
"outputStyle": "expanded"
},
"autoprefixer": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment