0
0
SASSmarkup~5 mins

Partial files with underscore prefix in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a partial file in Sass?
A partial file in Sass is a file that starts with an underscore (_) and is meant to hold Sass code that you want to include in other Sass files. It won't be compiled into a separate CSS file on its own.
Click to reveal answer
beginner
Why do Sass partial files start with an underscore?
The underscore tells Sass not to compile the file directly. Instead, it is used only when imported into other Sass files.
Click to reveal answer
intermediate
How do you import a partial file in Sass?
You use the @use or @import rule without the underscore or file extension. For example, @use 'variables'; will import _variables.scss.
Click to reveal answer
intermediate
What happens if you don't use an underscore for a Sass file you want to import?
If the file does not start with an underscore, Sass will compile it into its own CSS file, which might not be what you want if it's just a helper file.
Click to reveal answer
beginner
Can you explain the benefit of using partial files in Sass projects?
Partial files help organize your styles into smaller, manageable pieces. They keep your code clean and reusable without creating extra CSS files.
Click to reveal answer
What does the underscore (_) at the start of a Sass file name mean?
AThe file is a partial and won't compile to CSS on its own
BThe file is a CSS file
CThe file is ignored by Sass
DThe file is compiled twice
How do you import a partial file named _colors.scss in Sass?
A@import '_colors';
B@use '_colors.scss';
C@import 'colors.scss';
D@use 'colors';
What happens if you remove the underscore from a partial file name?
AIt will cause an error
BIt will be ignored by Sass
CIt will compile into a separate CSS file
DIt will merge with other files automatically
Why use partial files in Sass?
ATo make CSS files larger
BTo organize code and avoid extra CSS files
CTo slow down compilation
DTo avoid using variables
Which Sass rule is recommended for importing partials in modern Sass?
A@use
B@import
C@include
D@extend
Explain what a Sass partial file is and why it starts with an underscore.
Think about how Sass knows which files to compile and which to include only.
You got /4 concepts.
    Describe how to import a partial file in Sass and what happens if you forget the underscore in the file name.
    Focus on the import syntax and the effect of file naming on compilation.
    You got /4 concepts.