Last active
December 9, 2019 15:20
-
-
Save starryeyez024/d9be13f29dc09479b4a6143d3d24b0ef to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> 1% | |
last 2 versions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// 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}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: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