Sass --watch

Beginner
10 min read
Updated: Nov 2026
5 examples
Terminal logs

Definition and Usage

The Dart Sass --watch flag (short -w) acts like --update: it compiles outdated stylesheets once, then stays open and recompiles whenever those files or their dependencies change. Ideal while you edit SCSS locally.

Watch a single file pair or a whole folder with colon syntax. Pair with the rest of the Dart Sass CLI. Stop the process with Ctrl+C.

Official behavior.

Per the Sass docs: Sass watches directories you pass on the command line, parent directories of filenames you pass, and load paths — not extra folders discovered only through @use / @import / @forward.

Partials still skip CSS.

In folder mode, files starting with _ are not emitted as CSS outputs, same as a normal directory compile.

Dev loop, not CI.

Use --watch while coding. For production builds, run a one-shot compile (often with --style=compressed) without watching.

Syntax

terminal
# One file
sass --watch input.scss output.css

# Folder pair (many-to-many)
sass --watch themes:public/css
sass -w app/sass:public/stylesheets

# Network / virtual drives
sass --watch --poll themes:public/css

# One-shot outdated only (no stay-open)
sass --update themes:public/css

Pattern: pick file or folder targets → add --watch → leave the terminal open → save SCSS → read the compile log.

Flags & Patterns

Core watch-related shapes:

Command / flagMeaning
--watch / -wCompile, then keep rebuilding on change
sass --watch in.scss out.cssWatch one input → one output
sass --watch src:cssWatch a folder pair; skip _ partials
--pollTimer-based checks (only with --watch)
--updateRebuild outdated files once, then exit
--style=compressedStill applies on every watch rebuild
--load-path / -IExtra folders Sass also watches for changes
Ctrl+CStop the watcher process

CLI Examples

Commands match the Dart Sass CLI docs. Open View Typical Log for sample terminal output.

Example 1 — Watch One File

From the Sass guide: watch input.scss and write output.css.

terminal
sass --watch input.scss output.css

How It Works

  1. First compile writes output.css.
  2. Process stays open in the terminal.
  3. Each save of input.scss triggers another compile.
  4. Leave it running in its own tab; stop with Ctrl+C.

Example 2 — Watch a Folder Pair

Watch app/sass and emit CSS under public/stylesheets.

terminal
sass --watch app/sass:public/stylesheets

How It Works

  1. Colon syntax means many-to-many mode.
  2. Each non-partial maps to a CSS file in the output folder.
  3. Edits recompile the affected stylesheet.
  4. Short form: sass -w app/sass:public/stylesheets.

Example 3 — Watch with --poll

Use when native file watchers miss updates on network or virtual disks.

terminal
sass --watch --poll themes:public/css

How It Works

  1. --poll only works together with --watch.
  2. Timer checks replace OS file notifications.
  3. Use on remote / VM drives when saves do not trigger rebuilds.
  4. Slightly more CPU than native watching — enable only when needed.

Example 4 — npm sass:watch Script

Share one command with your team via package.json.

terminal
# package.json → "sass:watch": "sass --watch scss:css"
npm run sass:watch

How It Works

  1. npm runs the script string as a shell command.
  2. Install sass locally so the binary resolves.
  3. Same watch behavior as calling the CLI directly.
  4. Team-friendly — one documented command in the repo.

Example 5 — Watch + Compressed Style

Combine watch with formatting flags while still auto-rebuilding.

SCSS
.button {
  padding: 0.5rem 1rem;
  background: #036;
  color: #fff;

  &:hover { background: #024; }
}
terminal
sass --watch --style=compressed scss:dist/css

How It Works

  1. Watch does not lock you into expanded CSS.
  2. --style applies on every rebuild.
  3. Handy for staging previews that want minified CSS.
  4. Production CI should still prefer a one-shot compile without --watch.

Edge Cases & Pitfalls

Most --watch bugs are unwatched folders, missing poll, or leaving the process in CI.

scope

Only CLI paths are watched

Shared token folders used only via @use need to be on the command line or a --load-path.

poll

Saves ignored on network drives

Add --poll. Do not pass --poll without --watch.

ci

Do not watch in production CI

Watch never exits on its own. Use a one-shot sass / --update build step instead.

partials

Editing a partial may rebuild dependents

Changing _tokens.scss rebuilds files that load it — but no _tokens.css is written.

Sass Support

--watch is a Dart Sass CLI feature (since 1.6.0). Prefer Dart Sass for all new watch workflows.

ImplementationStatus
Dart Sass--watch since 1.6.0; --poll since 1.8.0
Ruby SassHad watch historically — now EOL (legacy notes)
LibSass / node-sassDeprecated toolchain — migrate to Dart Sass
BrowsersN/A — they only see compiled CSS

Confirm with sass --version. Pair watch with the rest of the Dart Sass CLI options.

Key Takeaways

  • Live loop: --watch compiles once, then rebuilds on save.
  • File or folder: space pair, or src:css colon map.
  • Add --poll when OS watchers miss network/VM saves.
  • Stop with Ctrl+C. Use one-shot compiles in CI.

One line: --watch keeps Sass compiling while you edit — save SCSS, get fresh CSS.

Compile Notes

Conceptual watch loop:

flow.txt
1. Resolve file / folder targets (and load paths)
2. First pass like --update (compile outdated sheets)
3. Register watchers (or start --poll timer)
4. On change: recompile affected stylesheets
5. Keep logging until Ctrl+C stops the process

Frequently Asked Questions

It compiles your Sass once, then keeps running and recompiles whenever watched source files (or their dependencies) change. Ideal while you edit styles locally.
Use a space-separated pair: sass --watch input.scss output.css. Every time you save input.scss, Sass updates output.css.
Use a colon between folders: sass --watch app/sass:public/stylesheets. Sass watches the input folder and writes CSS into the output folder.
Use -w. Example: sass -w scss:css. Same behavior as --watch.
If file-change notifications fail (common on some network or virtual drives), add --poll with --watch so Sass checks for changes on a timer instead of relying on the OS watcher.
Focus the terminal and press Ctrl+C (Cmd+C on some setups). That ends the watcher process.

Next: Sass Ruby Sass CLI

Legacy CLI reference only — then migrate fully to Dart Sass.

Ruby Sass CLI →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful