Variables
Sass variables are simple: you assign a value to a name that begins with $
, and then you can refer to that name instead of the value itself. But despite their simplicity, they're one of the most useful tools Sass brings to the table.
Variables make it possible to reduce repetition, do complex math, configure libraries, and much more.
Things to take note
- CSS also supports variables now
- But in SASS, it doesn't get compiled as variables. It simply replaces it with the actual values.
Example
$primary-color: #fefefe;
$secondary-color: #fff;