For CI/CD deployments (e.g., GitHub Pages, GitLab Pages, Netlify, etc.) you must edit the workflow to install Dart Sass before Hugo builds the site2. Some providers allow you to use one of the package managers above, or you can download and extract one of the prebuilt binaries.
To install Dart Sass for your builds on GitHub Pages, add this step to the GitHub Pages workflow file:
If you build Hugo from source and run mage test -v, the test will fail if you install Dart Sass as a Snap package. This is due to the Snap package’s strict confinement model.
In 2023, the Sass team deprecated Embedded Dart Sass in favor of Dart Sass. ↩︎
You do not have to do this if (a) you have not modified the assets cache location, and (b) you have not set useResourceCacheWhen to never in your site configuration, and (c) you add and commit your resources directory to your repository. ↩︎