Using @use lets you bring in built-in Sass modules to use their features. It helps keep your styles organized and easy to manage.
Importing built-in modules with @use in SASS
@use "sass:module-name";
Replace module-name with the built-in module you want, like color or math.
The @use rule loads the module once and gives it a namespace to avoid conflicts.
color module so you can use its color functions.@use "sass:color";
math module to use math functions like math.round().@use "sass:math";
list module to work with lists in Sass.@use "sass:list";
This Sass code imports the built-in color and math modules. It lightens a base blue color by 20% for the button background. It also rounds the padding value for neat spacing.
@use "sass:color"; @use "sass:math"; $base-color: #3498db; .button { background-color: color.scale($base-color, $lightness: 20%); padding: math.round(1.5)rem 2rem; color: white; border-radius: 0.5rem; }
Always use the @use rule at the top of your Sass file before other styles.
Built-in modules come with Sass, so you don't need to install anything extra.
Using namespaces like color. or math. helps avoid confusion with your own variables or functions.
@use imports built-in Sass modules to access their features.
It helps keep your styles organized and avoids naming conflicts.
Use the syntax @use "sass:module-name"; to import modules like color or math.