Skip to content

Sass builder (dart compiler) for .NET projects

License

Notifications You must be signed in to change notification settings

benco8186/DartSassBuilder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DartSassBuilder

A dart-compiled version of LibSassBuilder, using DartSassHost

Build NuGet Package .NET Global Tool
Build Nuget .NET Tool

DartSassBuilder NuGet package adds a build task to compile Sass files to .css. It's compatible with both MSBuild (VS) and dotnet build.

No configuration is required, it will compile the files implicitly on project build.

  • Optionally provide arguments (see Options below):

<PropertyGroup>
  <!-- outputstyle option -->
  <DartSassOutputStyle>compressed</DartSassOutputStyle>
  <DartSassOutputStyle Condition="'$(Configuration)' == 'Debug'">expanded</DartSassOutputStyle>
  <!-- add vendor prefix -->
  <DartSassPrefix>true</DartSassPrefix>
  <!-- level option -->
  <DartSassOutputLevel>verbose</DartSassOutputLevel>
  <!-- msbuild output level -->
  <DartSassMessageLevel>High</DartSassMessageLevel>
</PropertyGroup>
  • Or take control of what files to process

<PropertyGroup>
  <!-- take full-control -->
  <EnableDefaultSassItems>false</EnableDefaultSassItems>
</PropertyGroup>

<ItemGroup>
  <!-- add files manually -->
  <SassFile Include="Vendor/**/*.scss" />
  <SassFile Include="Styles/**/*.scss" Exclude="Styles/unused/**" />
</ItemGroup>
  • Or ignore all previous options (except for <DartSassMessageLevel>) and determine the arguments to the tool yourself

<PropertyGroup>
  <!-- Take even more full-control -->
  <DartSassBuilderArgs>directory "$(MSBuildProjectDirectory)"</DartSassBuilderArgs>
  <!-- msbuild output level -->
  <DartSassMessageLevel>High</DartSassMessageLevel>
</PropertyGroup>

Install:

dotnet tool install --global DartSassBuilder

Use:

dsb [optional-path] [options]
dsb help
dsb help directory
dsb help files

Generic options

-l, --level      Specify the level of output (silent, default, verbose)

--outputstyle    Specify the style of output (compressed, compact, nested, expanded)

Directory command (default)

Scans a directory recursively to generate .css files

-e, --exclude    (Default: bin obj logs node_modules) Specify explicit directories to exclude. Overrides the default.

--help           Display this help screen.

--version        Display version information.

value pos. 0     Directory in which to run. Defaults to current directory.

Example:

dsb directory
dsb directory sources/styles -e node_modules
dsb directory sources/styles -e node_modules -l verbose

Files in the following directories are excluded by default:

  • bin
  • obj
  • logs
  • node_modules

Files command (default)

Processes the files given on the commandline

--help           Display this help screen.

--version        Display version information.

value pos. 0     File(s) to process.

Example:

dsb files sources/style/a.scss sources/vendor/b.scss
dsb files sources/style/a.scss sources/vendor/b.scss -l verbose

Requirements

DartSassBuilder can be installed on any project, however the underlying build tool requires .NET 6 installed on the machine. (.NET 5 required with 0.1.x-beta)

Support

The support is largely dependant on DartSassHost

This tool contains the following supporting packages:

  • Microsoft.ClearScript.V8.Native.win-x64
  • Microsoft.ClearScript.V8.Native.win-x86
  • Microsoft.ClearScript.V8.Native.linux-x64
  • Microsoft.ClearScript.V8.Native.osx-x64
  • Microsoft.ClearScript.V8.Native.osx-arm64

Package as nuget package

./package.ps1 -PackageDir 'C:/LocalPackages' -Version '1.4.0.1'

About

Sass builder (dart compiler) for .NET projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 92.3%
  • PowerShell 6.0%
  • SCSS 1.5%
  • Sass 0.2%