![]() |
VOOZH | about |
dotnet add package LigerShark.WebOptimizer.Sass --version 3.0.147
NuGet\Install-Package LigerShark.WebOptimizer.Sass -Version 3.0.147
<PackageReference Include="LigerShark.WebOptimizer.Sass" Version="3.0.147" />
<PackageVersion Include="LigerShark.WebOptimizer.Sass" Version="3.0.147" />Directory.Packages.props
<PackageReference Include="LigerShark.WebOptimizer.Sass" />Project file
paket add LigerShark.WebOptimizer.Sass --version 3.0.147
#r "nuget: LigerShark.WebOptimizer.Sass, 3.0.147"
#:package LigerShark.WebOptimizer.Sass@3.0.147
#addin nuget:?package=LigerShark.WebOptimizer.Sass&version=3.0.147Install as a Cake Addin
#tool nuget:?package=LigerShark.WebOptimizer.Sass&version=3.0.147Install as a Cake Tool
This package compiles Sass/Scss into CSS by hooking into the LigerShark.WebOptimizer pipeline.
Add the NuGet package LigerShark.WebOptimizer.Sass to any ASP.NET Core project supporting .NET Standard 2.0 or higher.
> dotnet add package LigerShark.WebOptimizer.Sass
Since the original library is written in JavaScript, you will need a JS engine to run it. As a JS engine is used the JavaScript Engine Switcher library. First of all, you need to install the JavaScriptEngineSwitcher.Extensions.MsDependencyInjection package which makes registration of JS engines more convenient. Then you need to install one of the NuGet packages containing a JS engine provider:
After installing the packages, you will need to register the default JS engine.
The master branch is being updated for currently supported .NET releases (currently, .NET 8.0 and .NET 9.0).
For ASP.NET Core 2.x, use the 2.0 branch.
Here's an example of how to compile a.scss and b.scss from inside the wwwroot folder and bundle them into a single .css file called /all.css:
In Startup.cs, modify the ConfigureServices method:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
// Add JavaScriptEngineSwitcher services to the services container.
services.AddJsEngineSwitcher(options =>
{
options.AllowCurrentProperty = false;
options.DefaultEngineName = V8JsEngine.EngineName;
})
.AddV8()
;
services.AddWebOptimizer(pipeline =>
{
pipeline.AddScssBundle("/all.css", "a.scss", "b.scss");
});
}
...and add app.UseWebOptimizer() to the Configure method anywhere before app.UseStaticFiles, like so:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseWebOptimizer();
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
Now the path http://domain/all.css will return a compiled, bundled and minified CSS document based on the two source files.
You can also reference any .scss files directly in the browser (http://domain/a.scss) and a compiled and minified CSS document will be served. To set that up, do this:
services.AddWebOptimizer(pipeline =>
{
pipeline.CompileScssFiles();
});
Or if you just want to limit what .scss files will be compiled, do this:
services.AddWebOptimizer(pipeline =>
{
pipeline.CompileScssFiles("/path/file1.scss", "/path/file2.scss");
});
In _ViewImports.cshtml register the TagHelpers by adding @addTagHelper *, WebOptimizer.Core to the file. It may look something like this:
The TagHelpers are required in order for cache-busting version strings to be appended to the url. The ASP.NET LinkTagHelper attribute asp-append-version="true" is ignored.
@addTagHelper *, WebOptimizer.Core
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on LigerShark.WebOptimizer.Sass:
| Package | Downloads |
|---|---|
|
Blazura
Package Description |
Showing the top 2 popular GitHub repositories that depend on LigerShark.WebOptimizer.Sass:
| Repository | Stars |
|---|---|
|
madskristensen/Miniblog.Core
An ASP.NET Core blogging engine
|
|
|
madskristensen/PhotoGallery
ASP.NET Core Photo Gallery
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.147 | 43,485 | 1/18/2026 |
| 3.0.145 | 712 | 1/15/2026 |
| 3.0.143 | 52,903 | 10/20/2025 |
| 3.0.136 | 11,924 | 9/10/2025 |
| 3.0.123 | 208,571 | 8/8/2024 |
| 3.0.120 | 18,652 | 7/29/2024 |
| 3.0.118 | 90,662 | 4/3/2024 |
| 3.0.115 | 86,618 | 2/6/2024 |
| 3.0.102 | 28,276 | 10/16/2023 |
| 3.0.99 | 704,710 | 6/19/2023 |
| 3.0.97 | 13,219 | 5/22/2023 |
| 3.0.91 | 263,628 | 7/20/2022 |
| 3.0.84 | 50,170 | 3/21/2022 |
| 3.0.82-beta | 24,959 | 1/21/2022 |
| 3.0.81-beta | 488 | 1/20/2022 |
| 3.0.77-beta | 6,027 | 1/13/2022 |
| 3.0.75-beta | 9,064 | 1/12/2022 |