0
0
SASSmarkup~5 mins

@forward directive for re-exporting in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the @forward directive do in Sass?
The <code>@forward</code> directive lets you re-export styles, variables, and mixins from one Sass file to another, making them available to files that import the forwarding file.
Click to reveal answer
intermediate
How is @forward different from @import in Sass?
@forward re-exports members for other files to use, while @import brings styles directly into the current file. @forward helps organize and control what is exposed to users.
Click to reveal answer
intermediate
How do you hide a variable or mixin when using @forward?
Use the hide keyword with @forward to prevent specific members from being re-exported, e.g., @forward 'colors' hide $secret-color;
Click to reveal answer
intermediate
What is the purpose of the as keyword in @forward?
The as keyword lets you rename members when forwarding, for example: @forward 'buttons' as btn-*; prefixes all forwarded members with btn-.
Click to reveal answer
beginner
Can you use @forward multiple times in one file?
Yes, you can use @forward multiple times to re-export members from different Sass files, helping you create a single entry point for many modules.
Click to reveal answer
What does @forward 'colors'; do in a Sass file?
ARe-exports all members from the 'colors' file for others to use
BImports styles from 'colors' directly into the current file
CDeletes the 'colors' file
DRenames the 'colors' file
Which keyword hides members when using @forward?
Askip
Bexclude
Cremove
Dhide
How do you rename forwarded members with @forward?
AUsing the <code>as</code> keyword
BUsing the <code>rename</code> keyword
CUsing the <code>change</code> keyword
DUsing the <code>to</code> keyword
Can @forward replace @import in modern Sass projects?
ANo, <code>@import</code> is still required
BYes, <code>@forward</code> is part of the new module system replacing <code>@import</code>
CNo, they do completely different things
DYes, but only for CSS files
What happens if you use @forward multiple times in one file?
AOnly the first <code>@forward</code> works
BIt causes an error
CYou can combine exports from many files into one
DIt duplicates styles in the output
Explain how the @forward directive helps organize Sass code in a project.
Think about how you share variables and mixins across files.
You got /4 concepts.
    Describe how to hide and rename members when using @forward.
    Consider how you might want to keep some things private or change names.
    You got /3 concepts.