I'm running Visual Studio 2019 (16.3.9) using the Web Compiler extension (1.12.394) to compile scss files.
Here is a simple case that works. I have a file - test.scss:
$color: blue;
.button {
background-color: $color;
}
This gets compiled to this:
.button {
background-color: blue;
}
But if I try and do something like what is outlined here - https://sass-lang.com/documentation/at-rules/use#configuring-modules - it doesn't seem to work. I create another file - _base.scss:
$color: red !default;
.button {
background-color: $color;
}
Then I change my test.scss file to this:
@use 'base' with (
$color: blue
);
I expected that the compiled output would be the same as the original example:
.button {
background-color: blue;
}
But this is what I get:
@use 'base' with (
$color: blue
);
My guess is that the compiler is not happy with the @use rule, but I don't see any errors. _base.scss & test.scss are in the same directory. I'm only new to Sass, but surely this should be possible?
As mentioned, I'm new to Sass so was jumping straight in with the latest features. My first hunch, as mentioned by @Bauke, is that the current version of Web Compiler doesn't support @use (and other new features of Sass).
Based on this, I opted for a workaround with currently supported features that achieves the same result.
_base.scss:
test.scss:
Compiled output: