Blazorify.Sass
1.0.0-preview.251224173042
dotnet add package Blazorify.Sass --version 1.0.0-preview.251224173042
NuGet\Install-Package Blazorify.Sass -Version 1.0.0-preview.251224173042
<PackageReference Include="Blazorify.Sass" Version="1.0.0-preview.251224173042" />
<PackageVersion Include="Blazorify.Sass" Version="1.0.0-preview.251224173042" />
<PackageReference Include="Blazorify.Sass" />
paket add Blazorify.Sass --version 1.0.0-preview.251224173042
#r "nuget: Blazorify.Sass, 1.0.0-preview.251224173042"
#:package Blazorify.Sass@1.0.0-preview.251224173042
#addin nuget:?package=Blazorify.Sass&version=1.0.0-preview.251224173042&prerelease
#tool nuget:?package=Blazorify.Sass&version=1.0.0-preview.251224173042&prerelease
Blazorify.Sass
Lightweight C# wrapper around the Dart Sass compiler with first-class support for ASP.NET Core/Blazor. Ship SCSS with your app, compile to CSS at startup, and optionally watch for changes during development.
- Bundles Dart Sass binaries for Windows, Linux, and macOS (x64)
- Simple DI extensions to register SCSS inputs/outputs
- File watching with debounce to recompile on change
- Direct API for one-off string or file compilation
Install
dotnet add package Blazorify.Sass
Quick start (ASP.NET Core / Blazor)
Register your SCSS files and run the compiler during app startup:
using Blazorify.Sass;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddBlazorifySass(sass =>
{
sass.Register(new SassFileRegistration
{
// Source SCSS (can import/using other .scss files)
InputPath = "Styles/app.scss",
// Where the compiled CSS should be written
OutputPath = "wwwroot/css/app.css",
Watch = builder.Environment.IsDevelopment(),
Options = new SassCompilerOptions
{
IncludePaths = { "Styles", "Styles/partials" },
Style = "compressed",
SourceMap = false,
Quiet = true
}
});
});
var app = builder.Build();
app.UseBlazorifySass(); // Compiles registered files (and starts watchers when enabled)
app.UseStaticFiles();
app.MapFallbackToFile("index.html");
app.Run();
Direct compilation
If you only need programmatic compilation, resolve SassCompiler and call it directly:
var logger = app.Services.GetRequiredService<ILogger<SassCompiler>>();
var compiler = new SassCompiler(logger);
var css = compiler.Compile("$primary: #0ea5e9; .button { color: $primary; }",
new SassCompilerOptions { Style = "compressed" });
Console.WriteLine(css); // .button{color:#0ea5e9}
Options
SassCompilerOptions map closely to Dart Sass flags:
IncludePaths: Additional directories to resolve@import/@use.Style:"expanded"(default) or"compressed".SourceMap:trueto emit source maps.Quiet: Suppress warnings.
Set options per file via SassFileRegistration.Options or per call when using SassCompiler.
How it works
- Dart Sass binaries are packed under
runtimes/<RID>/native/dart-sass/. UseBlazorifySasscompiles each registered file and optionally starts aFileSystemWatcherto recompile on change (debounced at 300ms).- Logging uses
ILogger—enableDebuglevel to see the exact CLI calls.
Notes
- Target framework:
net10.0. - Supported runtimes: win-x64, linux-x64, osx-x64 (additional RIDs would need binaries added to
runtimes/). - For production, keep
Watch = falseand precompile during startup or at build time.
| Product | Versions 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. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Blazorify.Sass:
| Package | Downloads |
|---|---|
|
Blazorify.Bootstrap
A powerful Blazor component library that seamlessly integrates Bootstrap's responsive design and styling capabilities with the simplicity and efficiency of Blazor. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.251224173042 | 147 | 12/24/2025 |
| 1.0.0-preview.251223204523 | 144 | 12/23/2025 |
| 1.0.0-preview.250702044952 | 166 | 7/2/2025 |