Skip to content

Instantly share code, notes, and snippets.

@daneden
Last active May 23, 2019 08:08
Show Gist options
  • Save daneden/6fd650570fefe3382c7d to your computer and use it in GitHub Desktop.
Save daneden/6fd650570fefe3382c7d to your computer and use it in GitHub Desktop.
SASS Importing

Importing differentiation

You might be wondering why the Sass file here is using import directives with underscores, as opposed to the normal un-suffixed and un-prefixed importing (@import "base/all";, for example.)

Well, I’ve always had "_all.scss" as an importer for directories, but today I created a component SCSS file that appeared before "_all.scss" in the file browser.

To counter this, and make sure that the importer is always the first file I see in a directory of Sass files, I renamed the importers to "__all.scss". This has the added benefit of being extremely explicit in what exactly the imported file does—it’s in charge of pulling its siblings along with it.

// Imports
@import "variables/_all";
@import "functions/_all";
@import "mixins/_all";
@import "helpers/_all";
@import "components/_all";
@import "base/_all";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment