Sustainable SCSS

Organize with Partials

Partials in Sass are the files you split up to organize specific functionality in the codebase.

  • They use a _ prefix notation in the file name that tells Sass to hold off on compiling the file individually and instead import it.
  • To import this partial into the main file - or the file that encapsulates the important rules and the bulk of the project styles - omit the underscore.

For example, to import a file named _variables.scss, add the following line of code:

  @import "variables";

The global file imports all the components and centralizes the logic.

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.