Skip to content

Instantly share code, notes, and snippets.

@starryeyez024
Last active December 9, 2019 15:20
Show Gist options
  • Save starryeyez024/d9be13f29dc09479b4a6143d3d24b0ef to your computer and use it in GitHub Desktop.
Save starryeyez024/d9be13f29dc09479b4a6143d3d24b0ef to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
> 1%
last 2 versions
// ----
// libsass (v3.5.4)
// ----
// redhat-theme
:root {
--foo: 20px;
}
$padding: var( --foo);
// Use the calc function like this
$padding-double: calc( var( --foo, 12px) * 2) ;
// interpolate when a sass var is inside a calc function:
$padding-double: calc( #{$padding} * 2) ;
// This won't work:
//$padding-double: #{var( --foo, 12px)} * 2 ;
//$padding-double: $padding * 2 ;
// USE CASE EXAMPLES
.double {
width: $padding-double;
}
// interpolate when a sass var is inside a calc function
.test-again {
width: calc(50% - #{$padding-double});
}
:root {
--foo: 20px;
}
.double {
width: calc( var(--foo) * 2);
}
.test-again {
width: calc(50% - calc( var(--foo) * 2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment