Kaskada.Minify 1.1.3

dotnet add package Kaskada.Minify --version 1.1.3
NuGet\Install-Package Kaskada.Minify -Version 1.1.3
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="Kaskada.Minify" Version="1.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kaskada.Minify --version 1.1.3
#r "nuget: Kaskada.Minify, 1.1.3"
#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.
// Install Kaskada.Minify as a Cake Addin
#addin nuget:?package=Kaskada.Minify&version=1.1.3

// Install Kaskada.Minify as a Cake Tool
#tool nuget:?package=Kaskada.Minify&version=1.1.3

Kaskada Minify


.NET 6 CSS Minifier

What is this

Kaskada Minifier performs an operation on css known as 'minification'. Basically it takes in your cleanly structured css and produces a compressed version.

The input

body {
    color: red;
    padding: 10px 20px;
    /* border: 1px; */
}

becomes:

body{color:red;padding:10px 20px}

Installing

The easiest way is to use a nuget package (hosted on nuget.org here):

dotnet add package kaskada.minify

You can also build the code yourself:

  1. Make sure you have .NET 6 SDK installed (grab it here)
  2. Clone the repo: git clone https://github.com/kamgru/kaskada-minify.git
  3. Optionally test the code: dotnet test
  4. Build: dotnet build

Usage

First of all, add usings:

using Kaskada.Minify;
using Kaskada.Minify.Extensions;

There are four ways to use the minifier, depending on input and output:

  1. Read a file and output to file
Minifier.FromFile("input.css").ToFile("output.css");
  1. Read a file and output to string
string output = Minifier.FromFile("input.css").ToText();
  1. Minify from string to file
string input = "body { color: red; } ";
Minifier.FromText(input).ToFile("output.css");
  1. Minify from string to string
string input = "body { color: red; } ";
string output = Minifier.FromText(input).ToText();

Current limitations

Kaskada Minifier does not currently replace hashes (i.e. #ffffff to #fff)

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.3 864 6/24/2022
1.0.7 324 10/27/2021