Discover how a simple import can save you hours of tedious style updates!
Why Importing built-in modules with @use in SASS? - Purpose & Use Cases
Imagine you are writing styles for a website and want to use colors and math functions. You try to copy and paste code from different places or write the same color values and calculations again and again.
This manual way is slow and causes mistakes. If you want to change a color or fix a calculation, you must find and update every place manually. It's easy to forget some spots or make errors.
The @use rule lets you import built-in Sass modules like color and math once. Then you can use their functions and variables easily. This keeps your code clean, organized, and easy to update.
$primary-color: #ff0000; $secondary-color: #cc0000; .button { color: $primary-color; padding: 10px + 5px; }
@use 'sass:color'; @use 'sass:math'; .button { color: color.scale(#ff0000, $lightness: -20%); padding: math.add(10px, 5px); }
You can easily use powerful built-in tools for colors, math, and more, making your styles smarter and easier to maintain.
When building a website theme, you can import the color module to adjust shades dynamically and the math module to calculate spacing, all without rewriting code.
Manual copying of colors and calculations is slow and error-prone.
@use imports built-in Sass modules cleanly and safely.
This makes your styles easier to write, read, and update.