Compile SCSS files from the command line with powerful command-line tools. Watch, build, and optimize your stylesheets with ease.
sass input.scss output.css
Compile a single SCSS file to CSS
sass --watch input.scss:output.css
Watch for changes and recompile
Automatically recompile SCSS files when they change. Ideal for development workflows with continuous styling.
sass --watch styles.scss:styles.css
Generate source maps for easier debugging and mapping CSS styles back to their original SCSS source.
sass --style expanded --source-map input.scss output.css
Use multiple directories for imports using the --import-path flag. Great for large projects with modular Sass files.
sass --import-path=components --import-path=utils main.scss output.css
Compile .sass files using the older indented syntax. Supports legacy projects with minimal configuration.
sass --indented-slash --style compressed legacy.sass legacy.css
Compile multiple SCSS files to CSS with a single command using directory mappings.
Choose from nested, expanded, compact, or compressed CSS output for different needs.
Suppress non-essential output during builds for cleaner CI/CD pipelines and production workflows.
Feature | CLI | API |
---|---|---|
Primary Use Case | Build pipeline automation, developer workflows | Programmatic integration in tools/libraries |
Configuration | Command-line flags (--style, --watch, etc.) | Options object with programmatic API |
Watch Mode | Native --watch flag with file watching | Event-driven rebuild system |
Error Handling | Colored error messages with file/line | Error objects with source/position data |
Source Maps | --source-map flag with auto-mapping | Automatic with sourcemap option |
Build Caching | File-based rebuild only when needed | In-memory cache with rebuild tracking |
Choose your preferred method for global or local installation
npm install -g sass
Or use Ruby gem: gem install sass
Define your styles using SCSS or indented syntax
.btn
:
background:
#036
border-radius:
8px
&:hover
:
background:
#047
Use the compiler with default options or custom configuration
sass --style compressed input.scss output.css
Yes - the CLI is ideal for integration with Git Action, GitHub Actions, or CI/cd workflows. Use command-line flags for non-interactive builds.