Last active
March 4, 2022 13:00
-
-
Save zastrow/ca640bec6780407168ba4d4911d3974b to your computer and use it in GitHub Desktop.
Holy Trinity of Sass: Complex Function Demo
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) | |
// ---- | |
$sans: sans-serif; | |
$serif: serif; | |
$sans-weight: ( | |
lighter: 300, | |
bolder: 700 | |
); | |
$serif-weight: ( | |
lighter: 400, | |
bolder: 900 | |
); | |
@function weight($family:null, $weight:null, ) { | |
@if $weight == lighter or bolder { | |
@if $family == $sans { | |
@return map-get($sans-weight, $weight); | |
} | |
@else if $family == $serif { | |
@return map-get($serif-weight, $weight); | |
} | |
} | |
} | |
.my-class { | |
font-family: $serif; | |
font-weight: weight($serif, bolder); | |
} |
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
.my-class { | |
font-family: serif; | |
font-weight: 900; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment