{{ compiledCss }}
{{ sourceMapContent }}
ℹ️ About SASS/SCSS Compiler
Sass/SCSS Compiler converts Sass stylesheets into browser-ready CSS. It is useful when you need to test a small SCSS snippet, compare expanded and compressed output, debug a mixin, or turn copied framework variables into plain CSS without opening a full local build pipeline.
Sass supports two syntaxes. The
official Sass syntax guide
describes SCSS as the CSS-like syntax that uses braces and semicolons, while the indented .sass syntax uses
indentation instead. Both syntaxes compile to standard CSS, and both support variables, nested selectors, mixins,
functions, modules, and source maps.
Common uses:
- Compile SCSS to CSS for quick browser tests, demos, email templates, and one-off snippets.
- Check how variables, nesting, parent selectors, mixins, and functions expand before adding them to a project.
- Compare readable development CSS with compressed production CSS.
- Generate a source map when you need to trace compiled output back to the original Sass input.
- Convert indented Sass examples into CSS when a codebase or tutorial does not use SCSS syntax.
SCSS input:
$primary: #333;
$gap: 1rem;
@mixin card-tone($color) {
border-color: $color;
&:hover {
color: $color;
}
}
.card {
padding: $gap;
@include card-tone($primary);
}
Compiled CSS:
.card {
padding: 1rem;
border-color: #333;
}
.card:hover {
color: #333;
}
Indented Sass equivalent:
$primary: #333
$gap: 1rem
@mixin card-tone($color)
border-color: $color
&:hover
color: $color
.card
padding: $gap
@include card-tone($primary)
What the compiler understands:
- Variables: Values such as colors, spacing, and font stacks can be reused with
$name; see the Sass variables reference. - Nesting: Selectors can be grouped inside parent rules, including
&for hover states and modifiers; see Sass style rules. - Mixins: Reusable rule groups can take arguments and be included in multiple selectors; see Sass mixins and includes.
- Output style: The Sass command-line compiler documents expanded and compressed output modes in the Dart Sass CLI reference.
- Source maps: Source-map output follows the modern ECMA-426 source map specification used by browser developer tools.
Limitations and edge cases: This page is best for pasted Sass or SCSS entry points. It does not act as a
full project build system, and it does not fetch remote packages or expose server include paths. Imports only work when
the compiler can resolve them safely from the current input context. Output-style support depends on the Sass executable
installed on the server; modern Dart Sass focuses on expanded and compressed output. Legacy @import syntax may
still compile, but the Sass team documents it as deprecated in favor of @use and @forward in the
Sass import deprecation notice.
Sass code can contain proprietary design tokens, internal class names, or comments copied from a private stylesheet. Treat pasted source as sensitive if it comes from closed-source product CSS.
API Usage Example:
POST /api/tools/webdev/sass-compiler
Content-Type: application/json
{
"sass": "$primary: #3498db;\n$margin: 20px;\n\n.header {\n color: $primary;\n margin: $margin;\n \n &:hover {\n opacity: 0.8;\n }\n}",
"syntax": "scss",
"outputStyle": "expanded",
"sourceMap": false
}