Skip to content

brankosimic/AspNetCore.SassCompiler

 
 

Repository files navigation

AspNetCore.SassCompiler

NuGet Version

Sass Compiler Library for .NET Core 3.x/5.x. without node.

Installation

The installation of this package is quite simple, you can install this package using NuGet with the following command:

# Package Manager
PM> Install-Package AspNetCore.SassCompiler

# .NET CLI
dotnet add package AspNetCore.SassCompiler

Configuration

After adding the package, the Sass styles from the SourceFolder (defaults to: Styles) will automatically be compiled into .css files in the TargetFolder (defaults to: wwwroot\css) on build. You can also adjust the default (--style=compressed) dart-sass Arguments in the appsettings.json. To adjust any of the default configuration, please add one or more of the following settings to the appsettings.json:

{
  "SassCompiler": {
    "SourceFolder": "Styles",
    "TargetFolder": "wwwroot\\css",
    "Arguments": "--style=compressed"
  }
}

Sass watcher

To use the Sass watcher in your project, you must add the following code to your startup.cs:

public void ConfigureServices(IServiceCollection services) 
{
  
#if DEBUG
  services.AddSassCompiler();
#endif

}

I recommend adding the #if DEBUG statement to only use a watcher during debug mode.

Examples

As an example, a configured version of a .NET 5.0 project is added in the /Samples folder. Please see the link below for quick access

.NET 5.0

About

Sass Compiler Library for .NET Core 3.x/5.x without node.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C# 86.2%
  • Shell 8.9%
  • Batchfile 4.9%