Leveraging mixins
Mixins play an important role in Sass and help you write reusable code and use semantic HTML code.
Mixins are like macros and allow you to reuse properties and selectors. People used to functions programming will tend to see mixins like functions. Mixins do not return a value at runtime, but generate an output at compile time. For functions in Sass, read the Creating pure Sass functions recipe of this chapter.
Getting ready
You can test the mixins in this recipe with the Ruby Sass compiler. The Installing Sass for command line usage recipe of Chapter 1, Getting Started with Sass, describes how to install Ruby Sass on your system.
How to do it...
The steps beneath will help you to understand how to use mixins in your Sass code:
Create a Sass project file, which contains the following code:
@import 'components/responsive-utilities'; // scss-lint:disable ColorKeyword $side-bar-background-color: orange !default; .side-bar { @include hidden-mobile; background-color:...