YogeshChauhan . com

When you don’t want to @forward every member in SCSS (Sass)

in SCSS on May 30, 2021

Quick recap:

What are members in SassScript?

To understand @forward rule, you need to understand the @use rule first.

Here’s another post about @forward rule basics:

@forward rule in SCSS (Sass)

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;


Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 How to Use SQL MAX() Function with Dates? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

Jun 16 What are Stored Procedures for SQL Server? Jun 16 What are Class Constants in PHP? Jun 15 A short basic guide on states in React Jun 15 How to define constants in PHP? Jun 15 How to define visibility for a property in PHP? Jun 15 How to use @if and @else in SCSS?

You might also like these

What is a “promise” in JavaScript?JavaScriptAlternate Style Sheets in CSSCSSWordPress: How to find all posts from a custom post type with multiple custom fields values?WordPressHow to get Current Hour, Minute and Second in JavaScript?JavaScriptFive common features of Angular template syntax (with examples)AngularLearn to Make a Simple Contact Us Form using PHP and PDO-MySQLPHP