← Back to the glossary

Web design · Development · SEO

Sass / SCSS

Sass and SCSS explained: from source to CSS | scinet

Editorially reviewed ·

Clear definition

Sass is a language for preparing CSS. You write styles with additional features such as variables, mixins and modules. A compiler then translates that source into CSS the browser can use.

SCSS is the CSS-like Sass syntax with braces and semicolons. An indentation-based Sass syntax also exists. An SCSS file is therefore not another library: it is source code that needs processing before delivery.

What the extra processing gives you

Imagine several components requiring the same spacing calculation. Sass lets you express shared logic in functions or mixins. Modules help organize those rules across files.

Nesting can make related selectors easier to read. Excessive nesting, however, can create hard-to-follow dependencies. I would occasionally inspect the generated CSS as well. Short source code does not automatically mean a small or maintainable output file.

At a glance

SCSS source: Variables, mixins and modules. Sass compiler: Processes source during the build. CSS in the browser: Applies the generated rules
The browser receives CSS, not Sass source code. Sass variables are processed during the build; CSS variables may remain in the output.Open infographic in full size

Why @use and @forward matter

@use loads a Sass module and normally exposes its public variables, functions and mixins under a namespace. This makes the origin of values clearer. @forward passes public members of a module through another file, which can provide a shared entry point for several files.

Migrating an older project takes more than blindly replacing keywords. Check module paths, configuration and places that expected global variables. One functioning sample component is a useful first test before changing the entire styling system.

Sass or CSS custom properties?

The tools operate at different times. A Sass variable is processed during compilation. A CSS custom property remains in the stylesheet and is resolved in the browser. Custom properties therefore suit local theme values that vary between sections.

You can combine both: Sass organizes stylesheet generation while custom properties carry selected values into the running interface. Ordinary CSS may already be sufficient for a small website with few rules. What matters is whether the extra build step makes a real task easier and can be maintained reliably.

Related reading: CSS Custom Properties · Bulma · Bootstrap 6 Alpha compared.

Practical code example

SCSS

A variable before compilation

Original SCSS example. The generated CSS uses 1.5rem for padding; the Sass variable is resolved during compilation.

$card-spacing: 1.5rem;

.service {
  padding: $card-spacing;
  border: 1px solid #ccc;
}

Sources and further reading

  1. Documentation Sass Basics Sass · Checked
  2. Documentation @use Sass · Checked
  3. Documentation @forward Sass · Checked
  4. Documentation Variables Sass · Checked

Frequently asked questions

For styling, the browser needs the generated CSS file. The Sass compiler typically runs during development or the build process. The source file alone does not replace that step.

No. Modern CSS handles many tasks directly. Sass is useful when the project needs its extra features and the team can maintain them.