VOOZH about

URL: https://www.nuget.org/packages/SharpScss/

⇱ NuGet Gallery | SharpScss 3.0.0



dotnet add package SharpScss --version 3.0.0
 
 
NuGet\Install-Package SharpScss -Version 3.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="SharpScss" Version="3.0.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpScss" Version="3.0.0" />
 
Directory.Packages.props
<PackageReference Include="SharpScss" />
 
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 SharpScss --version 3.0.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SharpScss, 3.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 SharpScss@3.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=SharpScss&version=3.0.0
 
Install as a Cake Addin
#tool nuget:?package=SharpScss&version=3.0.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SharpScss 👁 ci
👁 NuGet

<img align="right" width="160px" height="160px" src="https://raw.githubusercontent.com/xoofx/SharpScss/master/img/SharpScss.png">

SharpScss is a P/Invoke .NET wrapper around libsass to convert SCSS to CSS.

Based on the version of libsass 3.6.6

Features

  • Pure P/Invoke .NET wrapper, no C++/CLI involved
  • Supports converting from a string or from a file
  • Supports include paths
  • Supports for source maps
  • Supports for libsass user custom importer callback in ScssOptions.TryImport
  • Supports for netstandard2.0 and net8.0+
  • Supports the following platforms:
    • win-x86
    • win-x64
    • win-arm
    • win-arm64
    • linux-x64
    • linux-arm
    • linux-arm64
    • linux-musl-x64
    • linux-musl-arm
    • linux-musl-arm64
    • osx-x64
    • osx-arm64

For older .NET2.0, .NET3.5, .NET4.x+ and netstandard1.3, you need to download the 1.4.0 version.

Download

SharpScss is available on 👁 NuGet

Usage

SharpScss API is simply composed of a main Scss class:

  • Scss.ConvertToCss: to convert a SCSS string to a CSS
var result = Scss.ConvertToCss("div {color: #FFF;}")
Console.WriteLine(result.Css);
  • Scss.ConvertFileToCss: to convert a SCSS file to a CSS
var result = Scss.ConvertFileToCss("test.scss")
Console.WriteLine(result.Css);

Using the ScssOptions you can specify additional parameters:

var result = Scss.ConvertToCss(@"div {color: #FFF;}", new ScssOptions()
{
	InputFile = "Test.scss",
	OutputFile = "Test.css", // Note: It will not generate the file, 
 // only used for exception reporting
 // includes and source maps
	GenerateSourceMap = true
});
Console.WriteLine(result.Css);
Console.WriteLine(result.SourceMap);

You can use also custom dynamic import through the delegate ScssOptions.TryImport. Note that in that cases ScssOptions.IncludePaths is not used and it is the responsability of the TryImport to perform the resolution (e.g on a virtual file system):

var result = Scss.ConvertToCss(@"@import ""foo"";", new ScssOptions()
{
	InputFile = "test.scss",
	TryImport = (ref string file, string path, out string scss, out string map) =>
	{
 // Add resolve the file
 // file = resolvedFilePath; // Can change the file resolved
		scss = ...; // TODO: handle the loading of scss for the specified file
		map = null;
		return true;
	}
});

Runtime

SharpScss depends on the native runtime libsass. This runtime is compiled for the following platform/runtime:

  • win-x86
  • win-x64
  • win-arm
  • win-arm64
  • linux-x64
  • linux-arm
  • linux-arm64
  • linux-musl-x64
  • linux-musl-arm
  • linux-musl-arm64
  • osx-x64
  • osx-arm64

On .NET Core (net8.0), the runtime is selected based on the Runtime Identifier - RID of your project.

  • You can add to your csproj the specific targeting runtimes your net8.0 with <RuntimeIdentifiers>win-x86;linux-x64</RuntimeIdentifiers> or <RuntimeIdentifier> if you have only one runtime to target (See Additions to the csproj format for .NET Core)

Build

Currently, the compiled version of libsass shipped with SharpScss is a custom build from the fork xoofx/libsass

This fork is mainly allowing to compile libsass without the MSVC C/C++ Runtime on Windows and provide a GitHub CI action to compile all different platforms.

License

This software is released under the BSD-Clause 2 license.

Author

Alexandre Mutel aka xoofx

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

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on SharpScss:

Package Downloads
Statiq.Sass

Statiq is a configurable static content generation framework. This library provides support for parsing Sass CSS content.

Wyam.Sass

Wyam is a simple to use, highly modular, and extremely configurable static content generator. This library provides support for parsing Sass CSS content.

Stasistium.Sass

Package Description

Fynydd.Halide

A treasure trove of useful extension methods, helpers, and tools for ASP.NET and MVC. Halide includes extension methods for manipulating base types (like strings, byte arrays, numerics), and static helper classes for HTTP and REST helpers, SQL data readers, security and encryption, file compression, SCSS compilation, CSS and JavaScript minification, and more. Halide requires no commercial third party components. You have all the source code, an MIT license, sunshine, and puppies.

NodeAssets.Compilers.Sass

.NET based minification compilers for scss based on the NSass/libsass projects

GitHub repositories (7)

Showing the top 7 popular GitHub repositories that depend on SharpScss:

Repository Stars
TCNOco/TcNo-Acc-Switcher
A Super-fast account switcher for Steam, Battle.net, Epic Games, Origin, Riot, Ubisoft and many others!
statiqdev/Statiq
Statiq is a flexible static site generator written in .NET.
smartstore/Smartstore
A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 10
ligershark/WebOptimizer
A bundler and minifier for ASP.NET Core
aelassas/wexflow
Workflow Automation Engine
statiqdev/Statiq.Framework
A flexible and extensible static content generation framework for .NET.
Wyamio/Wyam
A modular static content and static site generator.
Version Downloads Last Updated
3.0.0 137,100 11/2/2024
2.1.0 1,467 11/2/2024
2.0.0 893,336 6/28/2020
1.5.0 15,143 5/2/2020
1.4.0 679,081 6/25/2018
1.3.8 103,202 8/23/2017
1.3.7 4,580 5/14/2017
1.3.6 1,816 5/13/2017
1.3.5 1,812 5/13/2017
1.3.4 32,557 4/2/2017
1.3.3 1,821 4/2/2017
1.3.2 1,797 4/2/2017
1.3.1 1,829 4/2/2017
1.3.0 1,798 4/2/2017
1.2.0 5,107 6/27/2016
1.1.0 2,178 6/1/2016
1.0.1 2,743 4/5/2016
1.0.0 2,115 4/5/2016