Sass
New Features • Custom CSS Functions, Null Safety, and Dark Mode Support Available Now!

Sass CLI Tools

Compile SCSS files from the command line with powerful command-line tools. Watch, build, and optimize your stylesheets with ease.

Basic Compilation

sass input.scss output.css
                        

Compile a single SCSS file to CSS

Watch Mode

sass --watch input.scss:output.css
                        

Watch for changes and recompile

Powerful CLI Features

Watch Mode

Automatically recompile SCSS files when they change. Ideal for development workflows with continuous styling.

sass --watch styles.scss:styles.css

Source Maps

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

Import Paths

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

Sass Indented Syntax

Compile .sass files using the older indented syntax. Supports legacy projects with minimal configuration.

sass --indented-slash --style compressed legacy.sass legacy.css

Multiple Outputs

Compile multiple SCSS files to CSS with a single command using directory mappings.

Output Styles

Choose from nested, expanded, compact, or compressed CSS output for different needs.

Quiet Mode

Suppress non-essential output during builds for cleaner CI/CD pipelines and production workflows.

CLI vs API Comparison

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

Get Started in 3 Steps

1. Install Sass

Choose your preferred method for global or local installation

npm install -g sass
Or use Ruby gem: gem install sass

2. Create Sass File

Define your styles using SCSS or indented syntax

.btn:
  background: #036
  border-radius: 8px
  &:hover:
    background: #047

3. Compile to CSS

Use the compiler with default options or custom configuration

sass --style compressed input.scss output.css

CLI FAQ

Can I use the CLI in CI/cd pipelines?

Yes - the CLI is ideal for integration with Git Action, GitHub Actions, or CI/cd workflows. Use command-line flags for non-interactive builds.