SCSS 변수로 CSS 변수 만들기
Sass parses custom property declarations differently than other property declarations. All tokens, including those that look like SassScript, are passed through to CSS as-is.
SASS docs
이것은 문제를 일으킬 수 있다. 특히 내가 원하는 상황에서는
$primary-color: #30dbb4;
@mixin add-css-variable($name, $color) {
--#{$name}: $color;
}
:root {
// repeat as necessary for all your vars
@include add-css-variable('primary-color', $primary-color);
}
원더SassMeister playground에서 테스트를 할 수 있어요.
Reference
이 문제에 관하여(SCSS 변수로 CSS 변수 만들기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/frehner/making-css-vars-with-scss-vars-19dc텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)