Partials, Entry Points, and File Organization

A partial is a Sass source file intended to be loaded by another stylesheet rather than compiled as an independent entry point. Partial filenames conventionally begin with an underscore, such as _variables.scss or _buttons.scss.

A project may separate tokens, functions, mixins, base styles, layouts, components, and utilities into focused files. A small number of well-defined entry points can then compose the required modules.

Avoid creating a file for every trivial declaration. File boundaries should communicate architectural responsibility and make ownership clear.

A typical structure might look like this:

src/scss/
  abstracts/
    _tokens.scss
    _functions.scss
    _mixins.scss
  base/
    _reset.scss
    _typography.scss
  components/
    _buttons.scss
    _cards.scss
  layout/
    _header.scss
    _grid.scss
  main.scss

The underscore is a naming convention associated with Sass partials. A module is loaded through Sass's module resolution rules, and the importing file's path is resolved relative to the configured load paths.

A Modular Sass Architecture
Knowledge Check

What is the conventional purpose of an underscore-prefixed Sass partial?