7.4 Partials and modules
7.4.1 Why
- Make CSS composable rather than monolithic
- Capture one set of rules in one file (e.g., fonts, helpers, etc.)
- Compose a main Sass file that imports partials/modules as needed
7.4.2 How
- Create a files that start with
_
. Sass will recognize them as partials. - Import them with the
@import
directive. (Update: Sass says to use@use
instead, since@import
may be deprecated.)
See evocative example in the book.