The Sass @debug rule is written @debug <expression>;. It prints the value of that expression along with the filename and line number so you can inspect variables and calculations while developing.
Compilation continues and CSS still ships — debug lines go to the terminal / build log, not into the CSS file. Pass any Sass value, not just strings; Sass prints the same representation as meta.inspect().
Official pattern.
Per the Sass docs: log intermediate mixin math (for example a divider offset) with a labeled string before the value becomes CSS.
Development aid.
Use @debug for yourself while building. Prefer @warn / @error when messaging library users.
Remove before shipping.
Leave debug statements out of production builds so logs stay clean. Comment them out or delete them when finished.
Most @debug issues are noisy logs, wrong at-rule choice, or looking for messages in CSS.
css
Nothing appears in the CSS file
Debug lines go to the compiler log. If the stylesheet compiles, look in the terminal — not DevTools CSS.
noise
Loops can spam the log
Debugging every @each / @for iteration fills the console. Narrow the condition or remove after checking.
api
Not for library users
Use @warn for soft tips and @error for hard fails. @debug is a developer flashlight.
ship
Strip before production
Forgotten @debug statements clutter CI logs and can leak internal token shapes.
Toolchain
Sass Support
@debug is a core Dart Sass at-rule. Message formatting differs slightly by implementation; behavior (print and continue) is the same.
Implementation
Status
Dart Sass
Supported (recommended)
LibSass / node-sass
Supported (deprecated toolchain)
Ruby Sass
Supported (end-of-life)
Browsers
N/A — messages never reach CSS
Prefer Dart Sass for new projects. SCSS and indented syntax both support @debug.
Remember
Key Takeaways
Inspect:@debug <expr>; prints value + file + line.
Any value works — same representation as meta.inspect().
Does not stop the build; CSS still ships.
Temporary: remove before production; use @warn / @error for APIs.
One line:@debug is a compile-time flashlight — print values, keep building.
Compile
Compile Notes
@debug never reaches the browser. Conceptual flow:
flow.txt
1. Evaluate the @debug expression
2. Print filename, line, and inspected value to the log
3. Continue compiling (do not stop)
4. Emit CSS as usual — debug text stays out of the stylesheet
Frequently Asked Questions
It prints the value of an expression along with the filename and line number so you can inspect variables and calculations while developing your stylesheet.
No. Like @warn, it continues compiling and still emits CSS. Only @error stops the build.
Yes. You can pass any value. Sass prints the same representation as meta.inspect().
In the compiler / terminal / build log—not in the CSS file. Exact formatting varies by Sass implementation.
@debug is for inspecting values during development. @warn is for soft guidance to API users (deprecations, tips) and usually includes a stack trace meant for callers.
No. Remove or comment out debug statements before shipping so build logs stay clean. Prefer temporary checks while developing.