カスタムプロパティにSassの変数を渡すと変数のままコンパイルされてしまう
投稿日:
更新日:
事象
/* コンパイル前 */
$textPrimary: #000;
:root {
--color-text-primary: $textPrimary;
}
/* コンパイル後 */
:root {
--color-text-primary: $textPrimary;
}
解決方法
Sassのインターポレーション${}
を使うことで回避できる。
/* コンパイル前 */
$textPrimary: #000;
:root {
--color-text-primary: #{$textPrimary};
}