Skip to content
Related Articles

Related Articles

Why to put “_” in front of filename in SCSS ?

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 28 Nov, 2019

When we add “_” in front of the SCSS file, it means that it is partial for SCSS. When the compiler gets any SCSS files starting with “_”, it simply ignores the file. If you want this partial for SCSS to be included for styles, you must use @import. The advantage of using partials is that you can use style files to organize your code and all the files would be compiled on a single file. The purpose of partial SCSS is to keep your styles separated into logical sections.
In the end, we want one SCSS file to have complied whereas we can have many logical partial SCSS files.


@import filename;

Note: While importing we don’t put “_”, just the file name.

Examples 1: Let’s create a colors file _colors.scss

$first-color: blue;
$second-color: yellow;
// let's include it in main
// SCSS file, style.scss
@import "colors"
body {
  color: $first-color;
  background: $second-color;


body {
  color: blue;
  background: yellow; 

Examples 2: Let’s create a colors file _font.scss

$font: arial;
$color: red;
// Let's include it in main
// SCSS file, style.scss
@import "font";
body {
  font: 100% $font;
  color: $color;


body {
  font: 100% arial;
  color: red;

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!