Last active
April 26, 2023 05:35
-
-
Save haggen/4649531d084f56fd877e to your computer and use it in GitHub Desktop.
Text stroke using text-shadow as SCSS mixin.
This file contains 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
/** | |
* Text stroke using text-shadow. | |
* @example | |
* p { | |
* @include stroke(black, 2px); | |
* } | |
*/ | |
@mixin stroke($color, $size: 1px) { | |
$value: null; | |
@for $x from $size * -1 through $size { | |
@for $y from $size * -1 through $size { | |
@if not ($x == 0px and $y == 0px) { | |
$value: $value, $x $y $color; | |
} | |
} | |
} | |
text-shadow: $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great mixin!
but my preprocessor says
so i went with declaring $value with null
and the size default should have a unit with for visible results: