Last active
May 23, 2019 01:43
-
-
Save wadadanet/d3933b3eeabcda6b9a3d822141785326 to your computer and use it in GitHub Desktop.
css変数も出力できるsass設定
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
$theme-colors: ( | |
primary: #ffffff, | |
secondary: #cccccc, | |
success: #28a745, | |
info: #aaaaaa, | |
warning: #ffc107, | |
danger: #dc3545, | |
light: #f8f9fa, | |
dark: #343a40 | |
); | |
body{ | |
@each $key, $color in $theme-colors { | |
--c-#{$key}: #{$color}; | |
} | |
} | |
@function c($color_name){ | |
@return var(--c-#{color_name}); | |
} |
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
// 使用例 | |
.hoge { | |
color: c(primary) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment