EmbeddedSass.Net.Compiler 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package EmbeddedSass.Net.Compiler --version 1.0.0
                    
NuGet\Install-Package EmbeddedSass.Net.Compiler -Version 1.0.0
                    
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="EmbeddedSass.Net.Compiler" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EmbeddedSass.Net.Compiler" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="EmbeddedSass.Net.Compiler" />
                    
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 EmbeddedSass.Net.Compiler --version 1.0.0
                    
#r "nuget: EmbeddedSass.Net.Compiler, 1.0.0"
                    
#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 EmbeddedSass.Net.Compiler@1.0.0
                    
#: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=EmbeddedSass.Net.Compiler&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=EmbeddedSass.Net.Compiler&version=1.0.0
                    
Install as a Cake Tool

EmbeddedSass.Net

EmbeddedSass.Net is an asynchronous, thread-safe .NET host for the Embedded Sass Protocol.

The library runs a trusted Embedded Dart Sass executable supplied by the application or by the optional compiler package.

using EmbeddedSass.Net;
using EmbeddedSass.Net.Compiler;

await using var compiler = new SassCompiler(new SassCompilerOptions
{
    CompilerPath = "/absolute/path/to/dart-sass"
});

var result = await compiler.CompileStringAsync("$color: red; a { color: $color; }");
Console.WriteLine(result.Css);

The optional compiler package contains the x64 and ARM64 builds for Windows, macOS, and Linux, removing the need to manage an external executable:

using EmbeddedSass.Net;
using EmbeddedSass.Net.Compilation;
using EmbeddedSass.Net.Compiler;

var options = new SassCompilerOptions().UseBundledDartSass();
await using var compiler = new SassCompiler(options);

Imports

Filesystem imports can be resolved from one or more load paths:

var result = await compiler.CompileAsync(
    new SassCompileRequest(new SassStringInput("@use 'theme';"))
    {
        LoadPaths = ["/absolute/path/to/styles"]
    });

MSBuild integration

EmbeddedSass.Net.MsBuild compiles Sass before ASP.NET Core resolves static web assets. The package includes the Sass compiler, so a Sass installation is not required.

Add the package to the project:

<PackageReference Include="EmbeddedSass.Net.MsBuild" Version="1.0.0" />

Default behavior

When the project contains a Sass directory, the package:

  • Compiles every .scss and .sass file that does not begin with _.
  • Writes generated CSS to wwwroot/css.
  • Preserves relative directory paths.
  • Treats underscore-prefixed files as Sass partials.
  • Produces expanded CSS and external source maps in Debug builds.
  • Embeds source content in Debug source maps.
  • Produces compressed CSS without source maps in other configurations.

Explicit inputs

Add EmbeddedSass items to override the default Sass-to-wwwroot/css mapping.

<ItemGroup>
  <EmbeddedSass Include="Client/Styles">
    <OutputPath>wwwroot/assets/css</OutputPath>
    <LoadPaths>Client/Shared;vendor/styles</LoadPaths>
  </EmbeddedSass>

  <EmbeddedSass Include="Admin/admin.scss">
    <OutputPath>wwwroot/admin.css</OutputPath>
  </EmbeddedSass>
</ItemGroup>

For a directory item, OutputPath is the destination directory. Relative source directories are preserved.

For a file item, OutputPath is the exact generated CSS file path.

Explicit items can reference multiple source directories or individual entry files.

Item metadata

Parameter Applies to Description
Include Directory or file Source directory or Sass entry file to compile.
OutputPath Directory or file Destination directory for a directory item, or exact CSS file path for a file item.
LoadPaths Directory or file Semicolon-separated directories Sass can search when resolving imports and modules.

Project properties

<PropertyGroup>
  <EmbeddedSassEnabled>true</EmbeddedSassEnabled>
  <EmbeddedSassOutputStyle>Auto</EmbeddedSassOutputStyle>
  <EmbeddedSassGenerateSourceMap>Auto</EmbeddedSassGenerateSourceMap>
  <EmbeddedSassIncludeSourcesInSourceMap>true</EmbeddedSassIncludeSourcesInSourceMap>
  <EmbeddedSassQuietDependencies>false</EmbeddedSassQuietDependencies>
  <EmbeddedSassSilencedDeprecations></EmbeddedSassSilencedDeprecations>
</PropertyGroup>
Property Values Default behavior
EmbeddedSassEnabled true, false Enables or disables Sass compilation.
EmbeddedSassOutputStyle Auto, Expanded, Compressed Auto uses expanded CSS for Debug builds and compressed CSS for other configurations.
EmbeddedSassGenerateSourceMap Auto, true, false Auto generates source maps for Debug builds only.
EmbeddedSassIncludeSourcesInSourceMap true, false Controls whether original Sass source content is embedded in source maps.
EmbeddedSassQuietDependencies true, false Suppresses warnings generated by dependencies loaded through Sass load paths.
EmbeddedSassSilencedDeprecations Semicolon-separated deprecation IDs Suppresses selected Sass deprecation warnings. Leave empty to suppress none.

Generated CSS and source-map files are registered as project content, included during publish, and removed by the standard MSBuild clean process.

See the EmbeddedSass.Net.Sample.AspNetCore sample for a complete application.

AI Notice

AI tools were used as part of the development process and are disclosed here for transparency. The final code was reviewed, refactored and tested by a human (specifically me, @gumbarros ).

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.2.0 0 7/21/2026
1.1.0 45 7/20/2026
1.0.2 71 7/16/2026
1.0.1 51 7/16/2026
1.0.0 50 7/16/2026