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.
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
Typical terminal log
Compiled input.scss to output.css.
# After you save input.scss again...
Compiled input.scss to output.css.
How It Works
First compile writes output.css.
Process stays open in the terminal.
Each save of input.scss triggers another compile.
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
Typical terminal log
Compiled app/sass/main.scss to public/stylesheets/main.css.
Compiled app/sass/home.scss to public/stylesheets/home.css.
# After you edit app/sass/home.scss...
Compiled app/sass/home.scss to public/stylesheets/home.css.
How It Works
Colon syntax means many-to-many mode.
Each non-partial maps to a CSS file in the output folder.
Edits recompile the affected stylesheet.
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
Typical terminal log
Compiled themes/light.scss to public/css/light.css.
# Sass is polling for changes...
# After you save themes/dark.scss...
Compiled themes/dark.scss to public/css/dark.css.
How It Works
--poll only works together with --watch.
Timer checks replace OS file notifications.
Use on remote / VM drives when saves do not trigger rebuilds.
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
Confirm with sass --version. Pair watch with the rest of the Dart Sass CLI options.
Remember
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
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.