If I understand your qestion correctly, here is answer:

If the Sass transpiler is watching a directory (either through the command window or via an editor extension), you'll want to exclude changes to these files from transpilation, and Sass makes it easy to do so. Just prepend an underscore to their names.

Source: https://www.tutorialsteacher.com/sass/import-files-and-partials

Let's say you use:

"scss": "sass web/assets/scss/main.scss web/assets/css/main.css --style=compressed --watch"

When transpiller watching changes in main.scss where you importing files, then you get output in main.css. Then it does not matter if you import partials or not.

If you watch a directory, for example:

"scss": "sass web/assets/scss/ web/assets/css/ --style=compressed --watch"

Then, if you don't use partials, you will get every file separate in addition.

Answer from Bartlomiej Witkowski on Stack Overflow
🌐
Sass
sass-lang.com β€Ί guide
Sass: Sass Basics
You can create partial Sass files that contain little snippets of CSS that you can include in other Sass files. This is a great way to modularize your CSS and help keep things easier to maintain. A partial is a Sass file named with a leading underscore. You might name it something like ...
Blog
Posted 23 October 2025 by Natalie Weizenbaum Β· LibSass and the packages built on top of it have been deprecated since October 2020. In the five years since we made that announcement, the Sass language has continued to evolve to support the latest CSS features like color spaces, and embedded ...
Install
There are a good many applications that will get you up and running with Sass in a few minutes for Mac, Windows, and Linux. You can download most of the applications for free but a few of them are paid apps (and totally worth it) Β· The Sass team maintains two Node.js packages for Sass, both ...
Playground
Sass Β© 2006–2026 the Sass team, and numerous contributors. It is available for use and modification under the MIT License
Documentation
But if you’re using an older ... or Ruby Sass, there may be some behavioral differences. Anywhere behavior differs between versions or implementations, the documentation includes a compatibility indicator like this: ... Implementations with a "βœ“" fully support the feature in question, and implementations with a "βœ—" don’t support it all. Implementations with a version number started supporting the feature in question at that version. Implementations can also be marked as "partial"...
🌐
W3Schools
w3schools.com β€Ί sass β€Ί sass_import.asp
Sass @import and Partials
Sass has a mechanism for this: If you start the filename with an underscore, Sass will not transpile it. Files named this way are called partials in Sass.
🌐
Medium
medium.com β€Ί ampersand-academy β€Ί partials-in-sass-scss-5aae1beee414
Partials in SASS / SCSS. Partial SASS / SCSS is useful when the… | by Dinesh Kumar R | Ampersand Academy | Medium
January 10, 2021 - Reusing or maintaining such huge SCSS files is cumbersome. Partial SCSS allows developers to split the variable, resets or page-wise SCSS separately and quickly embed them in the main SCSS.
🌐
Simple Dev
simpledev.io β€Ί home β€Ί partials and modules – sass
Partials and modules - Sass - Simple Dev
May 16, 2022 - You can create a partial Sass file by adding an underscore to the beginning of the filename, like this: _colors.scss.
🌐
DEV Community
dev.to β€Ί sarah_chima β€Ί using-sass-partials-7mh
Using SASS partials - DEV Community
November 13, 2017 - A partial is simply an Sass file preceded by an underscore. An example is _name-of-file.scss. The underscore tells Sass that the file is a partial and that it should not be compiled to CSS.
Top answer
1 of 3
4

If I understand your qestion correctly, here is answer:

If the Sass transpiler is watching a directory (either through the command window or via an editor extension), you'll want to exclude changes to these files from transpilation, and Sass makes it easy to do so. Just prepend an underscore to their names.

Source: https://www.tutorialsteacher.com/sass/import-files-and-partials

Let's say you use:

"scss": "sass web/assets/scss/main.scss web/assets/css/main.css --style=compressed --watch"

When transpiller watching changes in main.scss where you importing files, then you get output in main.css. Then it does not matter if you import partials or not.

If you watch a directory, for example:

"scss": "sass web/assets/scss/ web/assets/css/ --style=compressed --watch"

Then, if you don't use partials, you will get every file separate in addition.

2 of 3
1

You can use either @import or @use in your SASS files.

When you have a look at the current best practices in SASS, we have a folder structure like this (see: Sass Guidelines):

sass/
|
|– abstracts/
|   |– _variables.scss    # Sass Variables
|   |– _functions.scss    # Sass Functions
|   |– _mixins.scss       # Sass Mixins
|   |– _placeholders.scss # Sass Placeholders
|
|– base/
|   |– _reset.scss        # Reset/normalize
|   |– _typography.scss   # Typography rules
|   …                     # Etc.
|
|– components/
|   |– _buttons.scss      # Buttons
|   |– _carousel.scss     # Carousel
|   |– _cover.scss        # Cover
|   |– _dropdown.scss     # Dropdown
|   …                     # Etc.
|
|– layout/
|   |– _navigation.scss   # Navigation
|   |– _grid.scss         # Grid system
|   |– _header.scss       # Header
|   |– _footer.scss       # Footer
|   |– _sidebar.scss      # Sidebar
|   |– _forms.scss        # Forms
|   …                     # Etc.
|
|– pages/
|   |– _home.scss         # Home specific styles
|   |– _contact.scss      # Contact specific styles
|   …                     # Etc.
|
|– themes/
|   |– _theme.scss        # Default theme
|   |– _admin.scss        # Admin theme
|   …                     # Etc.
|
|– vendors/
|   |– _bootstrap.scss    # Bootstrap
|   |– _jquery-ui.scss    # jQuery UI
|   …                     # Etc.
|
`– main.scss              # Main Sass file

As you can see, all SASS files begin with an underscore _, except the main.scss. All partial files are imported by the main file. There are two benefits:

  1. You can build a modular structure
  2. You need to transpile only one SCSS file (main.scss).

Example: sass sass\main.scss css\main.css

Important:

The Sass team discourages the continued use of the @import rule. Sass will gradually phase it out over the next few years, and eventually remove it from the language entirely. Prefer the @use rule instead.

(see: SAass: @import)

When you use @import to import all partials into your main file, they share one namespace. So when you use $myvar in two partials, the last imported variable will override it. Because of this you should prefer @use now, which creates a separate namespace for each partial file, e.g. mixins.$myvar, reset.$myvar.

🌐
Rip Tutorial
riptutorial.com β€Ί partials
sass Tutorial => Partials
You can create partial files that contain smaller snippets of your stylesheets. This allows you to modularize your CSS and allows for better structure of your stylesheets. A partial is a Sass file named with a leading underscore, i.e: _partial.scss.
🌐
Quackit
quackit.com β€Ί sass β€Ί tutorial β€Ί sass_partials.cfm
Sass Partials
Sass allows you to create partial Sass files that you can include in other Sass files. This enables you to reference information in another file.
🌐
YouTube
youtube.com β€Ί watch
Get your stylesheets more organized with Sass partials - YouTube
Using @use and @forward to get your partials working: https://youtu.be/CR-a8upNjJ0Sass Guidelines (and the 7-1 pattern): https://sass-guidelin.es/Andy Bell's...
Published Β  March 12, 2021
Find elsewhere
🌐
Reddit
reddit.com β€Ί r/frontend β€Ί why do we use partials in sass?
r/Frontend on Reddit: Why do we use partials in Sass?
August 5, 2015 -

I know this is a silly question, but I'm having a hard time understanding this.

So, I know that the purpose of partials is that Sass will not compile them into CSS files. To me, this makes sense in the case of a _variables.scss file, wherein we put all of our variables for use in the rest of the SCSS files.

However, a lot of people organize their code by modularizing their styles into various partials. They might have files like _forms.scss and _typography.scss and then import those files into a main.scss file.

My question is, why bother making those files a partial? Why not make them normal SCSS files and import them that way, then in the console run sass --watch scss/main.scss:css/main.scss? I can understand their being, for example, a _variables.scss partial (because in normal CSS there are no variables), but I don't understand why we do that for all of our modularized styles.

🌐
Sass
sass-lang.com β€Ί documentation β€Ί at-rules β€Ί use
Sass: @use
As a convention, Sass files that are only meant to be loaded as modules, not compiled on their own, begin with _ (as in _code.scss). These are called partials, and they tell Sass tools not to try to compile those files on their own.
Top answer
1 of 4
2

There is no module with the namespace "v". - color: v.$mainHeaderColor;

Your receiving the error when compiling main.scss because the _layout.scss partial file doesn't know about the namespace "v" and wasn't able to load the members like $mainHeaderColor from the _variables.scss module. This happens because _layout.scss doesn't have a @use rule loading the members from "variables", therefore it can't access variables defined in that module.

A "quick" fix would be to introduce a @use rule in your _layout.scss file to load the variables from _variables.scss like this:

@use "./variables" as v;

/* _layout.scss */

h1 {
    color: v.$mainHeaderColor;
}

Now there really isn't a need to use @forward with your current structure as its only two partial files being loaded into main.scss. If you want to use @forward I'd recommend reading further and setting up directories with index files.

To update your main file, this is how loading the files with @use at-rules into main.scss would look:

@use 'variables' as v;
@use 'layout';

/* main.scss */

/* Use the loaded members from '_variables.scss' inside the main file */
.demo {
  color: v.$mainHeadColor;
}

Using @use rules along with @forward and index files

With the @import at-rule slowly being phased out of the main implementation of Sass, (dart-sass). It's time for us to adopt @use rules and learn how to utilize the cool features like index files with @forward and setting custom namespaces for loaded modules.

Since @import at-rules made everything globally accessible, this is where I've seen most of the confusion around usage of @use come into play. We have to make sure all files have appropriate knowledge of variables, mixins, functions etc if they aren't defined in the same partial or file.


If you have a main.scss Sass file that is going to be compiled with two (or more) imported partial files. The best way to utilize @use and @forward rules is by creating a directory at the same level as your main.scss file (or elsewhere just use the correct path) and create an index file, _index.scss to load the entire directory of partials with a single @use rule.

Note: All @use at-rules must be placed at the top of the file.

This index file will be where you place your @forward rules, using @forward "<url>"; for each partial you want to load into the index file. Think of it as one big module that you can load elsewhere with a single @use rule in your main.scss file, thus giving you access to all of the partial files loaded into that index file within the /partials directory.

- main.scss 
- partials/
  - _index.scss
  - _variables.scss
  - _layout.scss
  ...

Going along with the example, lets say your _variables.scss partial file looked like this and wasn't relying on any other files:

$mainHeaderColor: #222;
$someOtherVar: #f06;

and if the _layout.scss partial wanted to use variables defined in _variables.scss, we would have to include a @use rule to let _layout.scss "know" about the loaded members.

@use "./variables" as v;

/* _layout.scss */

h1 {
    /* now this works as expected */
    color: v.$mainHeaderColor;
}

If you didn't want to define a namespace when loading with @use, simply write @use "<url>" as <namespace>; where the namespace being an asterisk * signals that a namespace won't be defined so you can use it like color: $mainHeaderColor instead of v.$mainHeaderColor. Note, this can leading to naming conflicts if your not careful.

Now to load these partials into the main.scss file which will be compiled, you could either use two separate @use rules for the _layout.scss and _variables.scss partials or create an index file (_index.scss) and load the /partials directory with a single @use at-rule giving you access to all the partials in the directory.

@forward "./variables";
@forward "./layout";

/* partials/_index.scss */

Voila! Now all that is left is to load the /partials directory into the main.scss file to be compiled and maybe used later on. The _layout.scss partial is loaded into main.scss through our single @use rule and we also have access to _variables.scss variables or any other partial file that was forwarded in the index file.

@use "./partials" as *;

/* main.scss */

h2 {
  color: $mainHeaderColor;
  background: $someOtherVar;
}

If you had a directory of mixins like ./mixins, then you would follow the same workflow of placing all partial files inside the /mixins directory and then create an _index.scss file to load the partials with @forward rules. To finally load the directory with a single @use rule giving you access to all of the partials loaded in a specific directory through an index file. I used the /partials directory as a "starting" point but it would make more sense to create a directory /vars, /mixins etc and place files in their respective directories for better structure/organization.

2 of 4
1

... and still no one has answered what the man asked.

I find it unbelievable that I've been trying for hours to find a solution to do this without using "@import".

The problem is so simple and yet no one simply answers with a straight solution. If we use an above example, he wants to have the variable $mainHeaderColor defined in the main.scss file, not in the _variables.scss partial. How then to @use the parent file since this would include all CSS from all child files?

I think the people who were "improving" SCSS seriously messed something up, as I am going back to @import as probably 99% of people.

Has anybody have simple solution?

🌐
YouTube
youtube.com β€Ί watch
Partials & Imports | Starting with Sass - YouTube
This series is all about getting up and running with the basics os Sass. In today's episode, we will be covering Partials and Imports which will help you mak...
Published Β  August 11, 2018
🌐
Netlify
itf-web-advanced.netlify.app β€Ί sass β€Ί partials
Partials | Webdesign Advanced
For example, if you would import the partial _reboot.scss before the partial _variables.scss, this would throw a bunch of errors as you would try to use variables in _reboot.scss that are not defined yet Β· @import "variables"; @import "mixins"; @import "reboot"; @import "links"; ... divide your Sass code into similar partials as the one used in this example, i.e., partials containing the variables (_variables.scss), mixins (_mixins.scss) and layout for the website (_reboot.scss and/or specific files for specific elements, e.g.
🌐
TutorialsTeacher
tutorialsteacher.com β€Ί sass β€Ί import-files-and-partials
Sass - Importing files and partials
A file that The transpiler will ignore it, but you can still include it in other Sass files. Files like these are known as "partials", and you can include them in another .scss file in the normal way.
🌐
Team Treehouse
teamtreehouse.com β€Ί library β€Ί sass-basics-2 β€Ί separate-your-stylesheet-into-partials
Separate Your Stylesheet Into Partials (How To) | Sass Basics | Treehouse
Sass partials let you split your stylesheet into separate files. They help modularize your CSS and keep things easier to maintain. Each partial is a single file and is like a small piece of the big CSS puzzle; it contains a portion of your ...
Published Β  April 19, 2017
🌐
Sass
sass-lang.com β€Ί documentation β€Ί at-rules β€Ί import
Sass: @import
As a convention, Sass files that are only meant to be imported, not compiled on their own, begin with _ (as in _code.scss). These are called partials, and they tell Sass tools not to try to compile those files on their own.
🌐
Studytonight
studytonight.com β€Ί sass β€Ί sass-partials
SASS Partials - Studytonight
SASS Partials are the files that contain small CSS code specific for a particular styling separated from the main stylesheet for managing the CSS code better.