0
0
SASSmarkup~5 mins

Index files for folder imports in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of an index file in folder imports in Sass?
An index file in Sass acts like a central place that gathers and re-exports all the styles from files inside a folder. This makes importing easier and cleaner by importing just the folder instead of each file separately.
Click to reveal answer
beginner
How do you name an index file in a Sass folder for automatic folder import?
You name the index file as <code>_index.scss</code>. Sass treats this file as the main entry point when you import the folder.
Click to reveal answer
beginner
What is the benefit of using index files for folder imports in Sass projects?
Using index files helps keep import statements short and organized. It reduces repetition and makes it easier to manage many Sass files by grouping them logically.
Click to reveal answer
beginner
How do you import a folder with an index file in Sass?
You simply import the folder name without specifying any file. Sass automatically looks for the <code>_index.scss</code> file inside that folder and imports it.
Click to reveal answer
intermediate
Can you have multiple index files in different folders in a Sass project?
Yes, each folder can have its own _index.scss file. This allows each folder to control what styles it exports when imported.
Click to reveal answer
What filename does Sass look for when importing a folder?
Aindex.scss
Bmain.scss
C_main.scss
D_index.scss
Why use an index file for folder imports in Sass?
ATo avoid using variables
BTo speed up compilation
CTo combine multiple files into one import
DTo write CSS faster
How do you import a folder named 'components' with an index file?
A@import 'components';
B@import 'components/_index.scss';
C@import 'components/index.scss';
D@import 'components/*';
Can you have multiple index files in a Sass project?
AYes, one per folder
BNo, only one per project
COnly if they have different names
DOnly in the root folder
What happens if a folder has no _index.scss file and you import it?
ASass imports all files automatically
BSass throws an error
CNothing is imported
DSass imports the first file alphabetically
Explain how index files simplify folder imports in Sass and how to use them.
Think about how you gather many small files into one main file for easier importing.
You got /4 concepts.
    Describe the benefits of organizing Sass files with index files in multiple folders.
    Consider how grouping related styles helps manage large projects.
    You got /4 concepts.