Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sass: @use makes error, undefined variable

I'm using Sass and want to use @use keyword instead of @import. Because, @import has many buggy problems. Also only dart-sass supports this feature, I changed node-sass into dart-sass. However, problem is occurred.

My original code

@import '@carbon/colors/scss/colors'

dart-sass and @use applied code

@use '@carbon/colors/scss/colors'

Error: Undefined variable.

How can I solve it?

like image 450
undefined Avatar asked Jun 01 '20 07:06

undefined


1 Answers

The problem might be that @use adds a namespace to your variables – in order to continue using variables like you did before (as color: $variable instead of color: namespace.$variable) you need to import it like so:

@use '@carbon/colors/scss/colors' as *;

according to the official docs.

like image 65
4ndroid4va Avatar answered Sep 16 '22 13:09

4ndroid4va