Sass !default keeps unthemed properties out of your CSS

Brad Frost has published a walkthrough of a theming pattern that relies on a single Sass flag. The scenario: you are building a theme and your stylesheet assigns a variable to a property, such as a form background color.

.c-text-input {
  background-color: $form-background-color;
  padding: 10px
}

The goal in the unthemed case is that no background-color declaration is emitted at all. The compiled output should contain the rest of the rule but drop that property entirely.

.c-text-input {
  padding: 10px;
}

As Frost demonstrates, Sass's !default flag handles this today. It is applied when the variable is set up, as shown below.

$form-background-color: null !default;

.c-text-input {
  background-color: $form-background-color; /* this line won’t exist in the outputted CSS file */
  padding: 10px;
}

$form-background-color: red;

.c-text-input-fancy {
  background-color: $form-background-color; /* this line will be “red” because we defined the variable */
  padding: 10px;
}

The note is worth keeping in mind when building complex Sass themes: it helps keep the final CSS as small as it can be.