Abstractions.Sass.CIBuild 1.1.74

There is a newer version of this package available.
See the version list below for details.
dotnet add package Abstractions.Sass.CIBuild --version 1.1.74
                    
NuGet\Install-Package Abstractions.Sass.CIBuild -Version 1.1.74
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Abstractions.Sass.CIBuild" Version="1.1.74" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Abstractions.Sass.CIBuild" Version="1.1.74" />
                    
Directory.Packages.props
<PackageReference Include="Abstractions.Sass.CIBuild" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Abstractions.Sass.CIBuild --version 1.1.74
                    
#r "nuget: Abstractions.Sass.CIBuild, 1.1.74"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Abstractions.Sass.CIBuild@1.1.74
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Abstractions.Sass.CIBuild&version=1.1.74
                    
Install as a Cake Addin
#tool nuget:?package=Abstractions.Sass.CIBuild&version=1.1.74
                    
Install as a Cake Tool

Sass Compiler

Based on and heavily influenced by the awesome WebCompiler by Mads Christensen. Compiles Sass/Scss files into CSS with cross-platform build support

What's new in the latest version

  • A url() is written to the CSS as it is in the Sass, as other Sass compilers do. The relative urls that the compiler rewrote came out broken, in compressed CSS almost every one. To write urls from the Sass file instead, turn on rewriteUrls, which now rewrites them correctly (see Relative urls below).
  • The paths of sassconfig.json are relative to its folder, loadPaths too, also in Visual Studio and in a build that compiles several projects.
  • Changing sassconfig.json or sassconfig.json.defaults compiles the files again, so a changed option takes effect at once.
  • Partials imported through loadPaths are tracked: changing one compiles the files that import it.
  • An import added to or removed from a partial counts at once, without restarting Visual Studio.
  • An unchanged source map is no longer written on every compile.

Choosing the runtime

The compiler can use DartSassHost in addition to LibSassHost, which is the default. Use DartSassHost in order to make use of newer SASS/SCSS features that are not supported by the now deprecated libsass.

To switch to dart-sass set the runtime parameter, either per file in sassconfig.json:

[
  {
    "outputFile": "wwwroot/site.css",
    "inputFile": "Styles/site.scss",
    "runtime": "LibSass"
  },
  {
    "outputFile": "wwwroot/someotherfile.css",
    "inputFile": "Styles/someotherfile.scss",
    "runtime": "DartSass"
  }
]

or globally in sassconfig.json.defaults:

{
  "sourceMap": false,
  "loadPaths": [],
  "style": "Expanded",
  "precision": 10,
  "lineFeed": "CrLf",
  "includeInProject": true,
  "runtime": "DartSass"
}

Key differences

  • Works with Visual Studio 2022
  • Only works with Sass/Scss files
  • No dependency on node; LibSassHost, or DartSassHost is used instead
  • CI builds works on Linux build hosts as well as Windows
  • Configuration files are simplified to reflect sass-only compilation
  • Errors point to the correct source file even when they occurred in an import

Visual Studio extension

A Visual Studio extension that compiles Sass/Scss files. Works with Visual Studio 2022, and supports CI/CD with cross-platform build support

Download the extension at the Coming soon

Features

  • Compilation of Sass/Scss files
  • Saving a source file triggers re-compilation automatically
  • Specify compiler options for each individual file
  • Error List integration
  • MSBuild support for CI scenarios
  • Shows a watermark when opening a generated file
  • Shortcut to compile all specified files in solution

Getting started

Right-click any .scss or .sass file in Solution Explorer to setup compilation.

A file called sassconfig.json is created in the root of the project. This file lets you modify the behavior of the compiler.

Right-clicking the sassconfig.json file or the corresponding project lets you easily run all the configured compilers.

Compile on save

Any time either a .scss or .sass file or one of the configuration files (sassconfig.json or sassconfig.json.defaults) is saved, the compiler runs automatically to produce the compiled output file.

Compile on build / CI support

You can enable compilation as part of the build step. Simply right-click the sassconfig.json file or the corresponding project to enable it.

A PackageReference will be added to the project. We recommend manually setting PrivateAssets = all. The NuGet package contains an MSBuild task that will run the exact same compilers on the sassconfig.json file in the root of the project.

The task runs before every build and cleans the output files on Clean. To skip it, for example in one configuration, set the property RunSassCompiler to False:

<PropertyGroup>
  <RunSassCompiler>False</RunSassCompiler>
</PropertyGroup>

The package runs in the 64-bit MSBuild: dotnet build, the build in Visual Studio, and MSBuild\Current\Bin\amd64\MSBuild.exe. It does not run in the 32-bit MSBuild\Current\Bin\MSBuild.exe, as it only has 64-bit native libraries.

Compile all

You can run the compiler on all sassconfig.json files in the solution by using the keyboard shortcut Shift+Alt+Y or by using the button on the top level Build menu.

Error list

When a compiler error occurs, the error list in Visual Studio will show the error and its exact location in the source file.

Source maps

Source maps are supported when enabled either in sassconfig.json or sassconfig.json.defaults.

Relative urls

By default, a url() is written to the CSS as it is in the Sass, as other Sass compilers do. A relative url is then relative to the CSS file, so write it from where the CSS ends up, or use a path that starts with /:

// Styles/site.scss, compiled to wwwroot/css/site.css
.logo { background: url(../images/logo.png); }   // wwwroot/images/logo.png
.hero { background: url(/images/hero.jpg); }      // from the root of the site

Set rewriteUrls to true, per file in sassconfig.json or for every file in sassconfig.json.defaults, to write relative urls from the Sass file instead. The compiler then rewrites them to be relative to the CSS file:

[
  {
    "inputFile": "wwwroot/styles/site.scss",
    "outputFile": "wwwroot/css/site.css",
    "rewriteUrls": true
  }
]

With that, url(images/logo.png) in wwwroot/styles/site.scss becomes url(../styles/images/logo.png) in the CSS. The query and fragment of a url are kept, and urls that start with / or #, or have a scheme (data:, https:), are never changed. The compiled CSS does not say which file a url came from, so a url in an imported partial is read as relative to the main Sass file, not to the partial.

Libraries such as Font Awesome and Bootstrap Icons write their urls relative to the CSS, so leave rewriteUrls off for them.

sassconfig.json

The extension adds a sassconfig.json file at the root of the project which is used to configure the compilation.

Here's an example of what that file looks like:

[
  {
    "outputFile": "wwwroot/site.css",
    "inputFile": "Styles/site.scss"
  },
  {
    "outputFile": "wwwroot/someotherfile.css",
    "inputFile": "Styles/someotherfile.scss",
    "sourceMap": "true",
    "style": "Compact"
  }
]

Default values for sassconfig.json can be found in the sassconfig.json.defaults file in the same location.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.4 14 11/20/2026
2.0.3 21 11/20/2026
2.0.2 99 11/16/2026
2.0.1 94 11/15/2026
2.0.0 141 11/14/2026
1.1.75 97 11/14/2026
1.1.74 97 11/13/2026
1.1.72 42,517 10/1/2025
1.1.71 432 9/30/2025
1.1.67 5,519 3/5/2025
1.1.65 3,810 1/21/2025
1.1.64 630 1/21/2025
1.1.63 623 1/21/2025
1.1.62 650 1/21/2025
1.1.60 981 1/17/2025
1.1.59 3,826 11/13/2024
1.1.58 1,133 10/21/2024
1.1.57 782 10/19/2024
1.1.56 718 10/18/2024
1.1.55 587 10/18/2024
Loading failed

Changes since 1.1.72:
- A url() is written to the CSS as it is in the Sass, as other Sass compilers do. The relative urls that the compiler rewrote came out broken (no closing parenthesis, no quotes or query, one folder short), in compressed CSS for almost every relative url.
- New: "rewriteUrls": true, in sassconfig.json or its defaults, reads relative urls as relative to the Sass file and rewrites them correctly for the CSS file.
- The paths of sassconfig.json, also loadPaths, are relative to its folder, whatever the current directory is. DartSass found no relative load path in the second project that a build compiled.
- A change to sassconfig.json or its defaults compiles the files again, so a changed option takes effect.
- A partial imported through loadPaths is a dependency: a change to it compiles the files that import it.
- Each project has its own dependencies, so a changed partial in a second project of a build is noticed.
- An import added to or removed from a partial counts at once, also in a long Visual Studio session or a build process that is kept between builds.
- Abstractions.Sass.CIBuild depends on no package: it no longer brings DartSassHost into the projects that use it.
- An unchanged source map is no longer written on every compile.