What’s the difference between SCSS and Sass?

Technology CommunityCategory: CSSWhat’s the difference between SCSS and Sass?
VietMX Staff asked 3 years ago

There are two syntaxes available for Sass. The first, known as SCSS (Sassy CSS) and used throughout this reference, is an extension of the syntax of CSS. This means that every valid CSS stylesheet is a valid SCSS file with the same meaning. This syntax is enhanced with the Sass features described below. Files using this syntax have the .scss extension.

The second and older syntax, known as the indented syntax (or sometimes just Sass), provides a more concise way of writing CSS. It uses indentation rather than brackets to indicate nesting of selectors, and newlines rather than semicolons to separate properties. Files using this syntax have the .sass extension.

Consider example.sass:

$color: red

=my-border($color)
  border: 1px solid $color

body
  background: $color
  +my-border(green)

Consider example.scss:

$color: red;

@mixin my-border($color) {
  border: 1px solid $color;
}

body {
  background: $color;
  @include my-border(green);
}