Installing Dart Sass

Development Enviroment

Follow the instructions below to install dart-sass binaries based on your operating system:

Installing on Linux

# Using Homebrew.
brew install sass/sass/sass

# Using Snap
sudo snap install dart-sass

Installing on MacOS

brew install sass/sass/sass

Installing on Windows

# Using Chocolatey
choco install sass

# Using Scoop
scoop install sass

Alternatively, you can download Dart Sass binaries directly from the dart-sass release page.

When using prebuilt binaries, make sure to add Dart Sass to your system’s PATH.

Build Enviroment

In a build environment, especially when deploying with CI/CD pipelines or Docker, you can ensure that Dart Sass is available using the following methods:

CI/CD deployment on GitHub pages

To install Dart Sass for CI/CD deployment on GitHub Pages, include the following step in your workflow file:

- name: Install Dart Sass
  run: sudo snap install dart-sass

Docker deployment

To install Dart Sass for Docker, include the following step in your Dockerfile:

# Replace the image with your deplyment Docker image
FROM ubuntu:20.04

RUN apt-get -y update \
 && apt-get -y install \
    ca-certificates \
    curl \
 && rm -rf /var/lib/apt/lists/*

WORKDIR /usr/local

# Replace the SASS_VERSION with the version you want to install
ARG SASS_VERSION=1.67.0
ARG SASS_URL="https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-linux-x64.tar.gz"

RUN curl -OL $SASS_URL

# Extract the release (if it's an archive)
RUN tar -xzf dart-sass-${SASS_VERSION}-linux-x64.tar.gz

# Clean up downloaded files (optional)
RUN rm -rf dart-sass-${SASS_VERSION}-linux-x64.tar.gz

ENV PATH=$PATH:/usr/local/dart-sass