The Dart Sass CLI is the sass executable that compiles .scss, .sass, and sometimes .css files to CSS from your terminal. It is the primary Sass implementation for new projects.
You can compile one file at a time, map many inputs to many outputs, watch folders while you edit, and control style, source maps, and load paths. Install first via Sass Installation, then deepen watching with --watch.
Two modes.
One-to-one: sass input.scss [output.css]. Many-to-many: sass input:output or sass src:css.
Extensions matter.
.scss → SCSS, .sass → indented syntax, .css → plain CSS. Stdin defaults to SCSS unless you pass --indented.
Prefer Dart Sass.
Ruby Sass is end-of-life. Use this CLI (not the legacy Ruby CLI) for all new work.
sass style.scss
# or write a file:
sass style.scss style.css
sass style.scss:style.css
Compiled CSS
h1 {
font-size: 40px;
color: #036;
}
How It Works
Space-separated paths are one-to-one mode.
No output path prints CSS to stdout.
Colon pairstyle.scss:style.css is many-to-many for one file.
Same CSS either way once variables resolve.
Example 2 — Compile a Directory
Map themes/ to css/. Files starting with _ are not emitted.
terminal
# themes/light.scss, themes/dark.scss, themes/_tokens.scss
sass themes:css
# Result: css/light.css and css/dark.css
# (_tokens.scss is a partial — no css/_tokens.css)
Output files
css/light.css
css/light.css.map
css/dark.css
css/dark.css.map
# no css/_tokens.css
How It Works
Directory mode mirrors each non-partial Sass file.
Partials (_) are skipped as CSS outputs.
Source maps are written by default next to CSS.
Share tokens via partials without empty CSS files.
Many-to-many mode needs Dart Sass 1.4+. --watch needs 1.6+. Check sass --version if a flag is missing.
Remember
Key Takeaways
Two modes: space paths (one-to-one) or colon pairs / folders (many-to-many).
Develop with--watch; ship with --style=compressed.
Partials starting with _ are skipped in directory compiles.
Dart Sass only for new projects — Ruby Sass is unmaintained.
One line: the Dart Sass CLI turns SCSS into CSS from the terminal — one file, whole folders, or a live watch loop.
Compile
Compile Notes
Conceptual flow when you run sass:
flow.txt
1. Resolve mode (one-to-one vs many-to-many)
2. Parse each input (.scss / .sass / .css / stdin)
3. Load modules via @use / load paths
4. Emit CSS (+ source map unless disabled)
5. Optionally keep watching (--watch) or exit
Frequently Asked Questions
The sass executable that compiles .scss, .sass, and sometimes .css files to CSS from the terminal. Install it via npm, Homebrew, Chocolatey, or a standalone binary.
sass <input.scss> [output.css] compiles one input file to one output file (or prints CSS to the terminal if you omit the output path).
sass input:output or sass srcDir:outDir compiles one or more pairs. Directory mode writes CSS for each Sass file and skips partials that start with _.
Pass --watch (or -w), usually with colon pairs: sass --watch themes:public/css. Sass recompiles when those files or their dependencies change.
Controls CSS formatting. expanded (default) is readable. compressed removes extra whitespace for production.
Yes when writing CSS files. Pass --no-source-map to skip them. Other flags control relative/absolute URLs and embedding.