0
0
SASSmarkup~20 mins

Index files for folder imports in SASS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Sass Index Import Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
What is the output of this Sass import resolution?

Given a folder styles/ containing _index.scss and _buttons.scss, what file(s) will be imported by @use 'styles';?

SASS
@use 'styles';
ABoth _index.scss and _buttons.scss are imported
BNo files are imported, error occurs
COnly _buttons.scss is imported
DOnly _index.scss is imported
Attempts:
2 left
💡 Hint

Think about how Sass resolves folder imports with index files.

🧠 Conceptual
intermediate
2:00remaining
Why use an index file for folder imports in Sass?

What is the main benefit of having an _index.scss file inside a folder for Sass imports?

AIt allows importing multiple files with a single import statement
BIt prevents any files in the folder from being imported
CIt automatically compiles all Sass files in the folder separately
DIt disables Sass linting for the folder
Attempts:
2 left
💡 Hint

Consider how you can simplify import statements.

📝 Syntax
advanced
2:00remaining
Which option correctly imports all Sass partials in a folder using an index file?

Given a folder components/ with _index.scss, _header.scss, and _footer.scss, which _index.scss content correctly imports all partials?

A
@use './header';
@use './footer';
B
@import 'header';
@import 'footer';
C
@use 'components/header';
@use 'components/footer';
D
@use 'header';
@use 'footer';
Attempts:
2 left
💡 Hint

Remember relative paths inside index files and modern Sass import syntax.

optimization
advanced
2:00remaining
How does using an index file improve Sass build performance?

What is a key reason that using an _index.scss file for folder imports can optimize Sass compilation?

AIt disables source maps for faster builds
BIt compiles each partial into a separate CSS file automatically
CIt reduces the number of import statements and dependency checks
DIt caches all partials in memory permanently
Attempts:
2 left
💡 Hint

Think about how Sass processes imports and dependencies.

🔧 Debug
expert
2:00remaining
Why does this Sass import fail when using an index file?

Given this folder structure:

components/
  _index.scss
  _button.scss
  _card.scss

And _index.scss content:

@use 'button';
@use 'card';

Why does @use 'components'; in main.scss cause an error?

ABecause Sass does not support @use inside index files
BBecause @use inside _index.scss needs relative paths like './button' and './card'
CBecause _index.scss must be named _components.scss to work
DBecause @use cannot import partials starting with underscore
Attempts:
2 left
💡 Hint

Check how paths are resolved inside index files.