Created
December 8, 2021 19:40
-
-
Save maninak/d455166ac4f5b4ea5dd32d7ffb76b4ff to your computer and use it in GitHub Desktop.
A handy SASS mixin allowing using one-off color classes and @apply from Tailwind CSS the familiar way without needing to add them in the global config.
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
@tailwind base; | |
@mixin tw-base-layer-wrap { | |
@layer base { | |
@content; | |
} | |
@content; | |
} | |
@mixin tw-color-classes($cname, $color) { | |
@include tw-base-layer-wrap { | |
.text-#{$cname} { | |
color: #{$color}; | |
} | |
.bg-#{$cname} { | |
background-color: #{$color}; | |
} | |
.border-#{$cname} { | |
border-color: #{$color}; | |
} | |
} | |
} | |
// @use '../assets/css/utils' as utils; | |
// @include utils.tw-color-classes('investment-ideas-light', #f1e9d8); | |
// @include utils.tw-color-classes('investment-ideas-dark', #31434a); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment