Compile SCSS and Sass Online: Partials, @use and Source Maps Explained
How Sass compiles to CSS, when to use @use instead of @import, how partials and source maps work, and how to compile a small project in the browser.

Sass is the most widely used CSS preprocessor. It adds variables, nesting, mixins, loops, functions and a module system to CSS, and the files you write are turned into ordinary CSS before a browser ever sees them. That compile step is usually handled by a build tool, but sometimes you only want to try an idea, check what a theme file produces or fix a stylesheet someone sent you, without installing Node and a bundler first.
Two syntaxes, one language
Sass has two ways of writing the same thing. SCSS, in files ending in .scss, uses braces and semicolons and accepts any valid CSS, so you can rename a .css file to .scss and start adding features. The indented syntax, in .sass files, drops braces and semicolons and uses indentation to show nesting. It also writes mixins with an equals sign and includes them with a plus. Both compile to identical CSS, and a project can mix them.
Partials and modules
A partial is a Sass file whose name starts with an underscore, such as _tokens.scss. The underscore tells the compiler not to turn it into its own CSS file. You load it from another file, and the loading rules are generous: @use "tokens" finds _tokens.scss, tokens.scss, _tokens.sass or a folder called tokens with an index file inside.
There are two ways to load files. The old @import pastes the file in, makes everything global and can load the same file several times. The newer @use loads a file once and gives its variables, mixins and functions a namespace, so you write tokens.$space instead of $space. @forward lets one file pass members of another on to whoever uses it, which is how libraries build a single entry point. @import is deprecated and will be removed in a future major version, so new code should use @use and @forward.
Compiling in the browser
The SCSS and Sass Compiler runs Dart Sass, the official implementation, in its JavaScript build. The compiler is fetched once from a public CDN at a fixed version and cached, and your files stay in the page.
- Start with the sample or your own files. The sample has a main file, a tokens partial with spacing, radius and a colour map, and an indented .sass file with a mixin. Tap Open to load your own .scss, .sass or .css files.
- Add partials. Create a file with a name like _mixins.scss and load it with @use from the entry file. Folders work too: a file named base/_reset.scss is found by @use "base/reset".
- Mark the entry file. Only the file with the star is compiled; everything else is reached through it.
- Choose the output. Expanded output is easy to read and review. Compressed output removes spaces and line breaks for production.
- Read errors. When something is wrong, the message shows the file, line and column. Undefined variables, missing semicolons and unknown mixins are the usual suspects.
- Copy or download. Copy the CSS or download it, along with a source map if you asked for one.
Compiling happens as you type, a fraction of a second after you stop, so you can watch how each change affects the CSS.
Source maps
A source map is a small JSON file that records which line of Sass produced each line of CSS. When the CSS references it with a sourceMappingURL comment, browser developer tools show your .scss file and line instead of the compiled CSS. You can save the map as a separate file next to the CSS, which is best for production because the map is only downloaded when someone opens the developer tools, or inline it at the bottom of the CSS, which is handy for quick tests.
Watching nesting
Nesting is Sass's most loved feature and its most abused one. Deeply nested rules produce long, very specific selectors that are hard to override later. The nesting outline in the tool lists each nested selector next to what it becomes, with the ampersand resolved, so .card with a nested &__title shows as .card__title and a nested .icon shows as .card .icon. If a line in the outline is longer than you would ever write by hand, flatten it.
Warnings worth reading
Dart Sass prints deprecation warnings for features on their way out, such as @import, global built-in functions like darken() instead of color.adjust(), and slash division instead of math.div(). The tool lists them below the output. Fixing them now saves a broken build after the next major Sass release.
What it does not do
The browser compiler cannot read packages from node_modules by name, so a line such as @use "bootstrap" will not resolve. Copy the partials you need into the project instead. It also cannot load files from remote URLs. For large production builds, keep using your build tool; for experiments, snippets and quick fixes, compiling in the browser is often faster than setting anything up.



