2. Which of the following is the correct way to import a partial file named _buttons.scss into main.scss using the 7-1 pattern?
easy
A. @import 'buttons';
B. @import '_buttons.scss';
C. @import 'buttons.scss';
D. @import 'buttons/_buttons';
Solution
Step 1: Recall Sass partial import syntax
Partial files start with an underscore and are imported without the underscore or file extension.
Step 2: Apply correct import syntax
So, _buttons.scss is imported as @import 'buttons'; in main.scss.
Final Answer:
@import 'buttons'; -> Option A
Quick Check:
Import partials without underscore or extension [OK]
Hint: Drop underscore and .scss when importing partials [OK]
Common Mistakes:
Including underscore in import statement
Adding .scss extension in import
Using folder path incorrectly
3. Given this folder structure in the 7-1 pattern: sass/ ├── abstracts/_variables.scss ├── base/_reset.scss ├── components/_buttons.scss └── main.scss What will happen if main.scss contains: @import 'abstracts/variables'; @import 'base/reset'; @import 'components/buttons'; and you compile main.scss?
medium
A. All styles from variables, reset, and buttons partials will be combined into one CSS file
B. Only the styles from main.scss will be compiled, ignoring imports
C. A syntax error will occur because folder names cannot be used in imports
D. The compiler will create separate CSS files for each imported partial
Solution
Step 1: Understand how imports work in Sass
When you import partials in main.scss, their styles are combined into one CSS output.
Step 2: Analyze the import paths
Using folder names like abstracts/variables is valid and imports the partial correctly.
Final Answer:
All styles from variables, reset, and buttons partials will be combined into one CSS file -> Option A
Quick Check:
Imports merge partials into one CSS [OK]
Hint: Imports combine partials into one CSS file [OK]
Common Mistakes:
Thinking imports create separate CSS files
Believing folder names are invalid in imports
Assuming imports are ignored during compilation
4. You have this import in main.scss: @import 'layout/grid'; But when compiling, you get an error: File to import not found or unreadable: layout/_grid.scss. What is the most likely cause?
medium
A. Sass does not support nested folders in imports
B. You should import as @import 'layout/_grid.scss'; including underscore and extension
C. The main.scss file must be inside the layout folder
D. The file _grid.scss is missing from the layout folder
Solution
Step 1: Check the error message
The error says the file layout/_grid.scss cannot be found or read.
Step 2: Understand import rules
Importing @import 'layout/grid'; expects a file named _grid.scss inside the layout folder.
Final Answer:
The file _grid.scss is missing from the layout folder -> Option D
Quick Check:
Missing partial file causes import error [OK]
Hint: Check if partial file exists in correct folder [OK]
Common Mistakes:
Including underscore and extension in import
Moving main.scss into partial folders
Assuming Sass disallows folder nesting
5. In the 7-1 folder pattern, you want to add a new component style for a card UI element. Where should you place the partial file and how should you import it in main.scss?
hard
A. Place _card.scss in the root sass folder and import with @import 'card';
B. Place _card.scss in the base folder and import with @import 'base/card';
C. Place _card.scss in the components folder and import with @import 'components/card';
D. Place _card.scss in the abstracts folder and import with @import 'abstracts/card';
Solution
Step 1: Identify the correct folder for UI components
The 7-1 pattern uses the components folder for UI parts like buttons, cards, and modals.
Step 2: Use proper import syntax in main.scss
Place _card.scss inside components and import as @import 'components/card';.
Final Answer:
Place _card.scss in components folder and import with @import 'components/card'; -> Option C
Quick Check:
UI parts go in components folder [OK]
Hint: Put UI parts in components folder, import with folder/name [OK]