Quick recap:
To understand @forward rule, you need to understand the @use rule first.
Here’s another post about @forward rule basics:
Sometimes, you want to forward the whole module and every function, mixin or variables but other times, you want to keep some members private. Private members can be used by the module or package they are declared in.
@forward show and hide
You can use @forward “” show or @forward “” hide to control members visibility.
For e.g. let’s say we have @mixins in _list.scss module.
// src/_list.scss
$horizontal-list-gap: 2em;
@mixin list-reset {
margin: 0;
padding: 0;
list-style: none;
}
@mixin list-horizontal {
@include reset;
li {
display: inline-block;
margin: {
left: -2px;
right: $horizontal-list-gap;
}
}
}
If you want to hide just a handful listed members and forward everything else then use @forward “” hide.
Just like this:
// bootstrap.scss
@forward "src/list" hide list-reset, $horizontal-list-gap;
If you want to hide everything else but just forward handful listed members then use @forward “” show.
// bootstrap.scss
@forward "src/list" show list-reset, $horizontal-list-gap;
forward functions mixin Modules rules visibility