Sass reads a stylesheet as a sequence of Unicode code points and parses it directly—not by building a separate token stream first.
UTF-8 first.
With Dart Sass, encode every .scss / .sass file as UTF-8. That is the safe default for all modern Sass work.
Parse errors stop the build.
Invalid syntax fails immediately with a location and reason. Unlike CSS, Sass does not try to recover and keep emitting stylesheet text.
Not a strict CSS superset here.
Error handling is one of the few places SCSS differs from CSS: Sass prefers early, clear failure over silent recovery.
How it works
How Parsing Works
pipeline.txt
1. Bytes on disk → decode as Unicode (UTF-8 with Dart Sass)
2. Unicode text → parse as Sass syntax (SCSS or indented)
3. Valid tree → compile to CSS
4. Invalid syntax → stop with file / line / column + reason
Older compilers could detect encoding via a BOM or @charset. Dart Sass supports UTF-8 only—save files as UTF-8 and you are set.
Reference
Key Ideas
What the official parsing model emphasizes:
Topic
Takeaway
Input
Unicode code points, parsed directly
Encoding (Dart Sass)
UTF-8 only—encode source as UTF-8
Parse error
Fail fast with location + reason; no CSS for that compile
Unicode in, CSS out—Sass parses code points directly.
UTF-8 for every Dart Sass source file.
Parse errors fail fast with file, line, and reason.
Not CSS recovery—fix syntax, then recompile.
One line: save UTF-8, write valid SCSS/Sass, and treat compiler errors as the first place to look when CSS does not appear.
Practice
Compile Notes
Practical checklist:
checklist.txt
1. Save the file as UTF-8
2. Pick .scss or .sass (see Syntax)
3. Match braces / indentation
4. Use $name: value; for variables
5. Read the caret + line when the compiler fails
Frequently Asked Questions
A Sass stylesheet is parsed from a sequence of Unicode code points. It is parsed directly, without first being converted to a token stream.
Encode Sass files as UTF-8. Dart Sass currently only supports UTF-8. Older implementations had broader encoding detection (BOM and @charset).
Parsing fails immediately and Sass shows where and why. No CSS is produced for that compile. This differs from CSS, which recovers from many errors.
Almost—but parse-error handling is one of the few cases where SCSS is not strictly a CSS superset. Seeing errors early is usually better for authors.
Implementation APIs expose spans or file/line/column. In Dart Sass: SassException.span. In the JS API: file, line, and column properties.
With Dart Sass, UTF-8 is assumed. Saving source as UTF-8 is the important part; a @charset rule is not required for Dart Sass to parse the file.