MonorailCss.Build.Tasks 0.0.5-alpha.0.165

This is a prerelease version of MonorailCss.Build.Tasks.
dotnet add package MonorailCss.Build.Tasks --version 0.0.5-alpha.0.165
                    
NuGet\Install-Package MonorailCss.Build.Tasks -Version 0.0.5-alpha.0.165
                    
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="MonorailCss.Build.Tasks" Version="0.0.5-alpha.0.165">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MonorailCss.Build.Tasks" Version="0.0.5-alpha.0.165" />
                    
Directory.Packages.props
<PackageReference Include="MonorailCss.Build.Tasks">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 MonorailCss.Build.Tasks --version 0.0.5-alpha.0.165
                    
#r "nuget: MonorailCss.Build.Tasks, 0.0.5-alpha.0.165"
                    
#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 MonorailCss.Build.Tasks@0.0.5-alpha.0.165
                    
#: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=MonorailCss.Build.Tasks&version=0.0.5-alpha.0.165&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MonorailCss.Build.Tasks&version=0.0.5-alpha.0.165&prerelease
                    
Install as a Cake Tool

MonorailCSS

Nuget (with prereleases)

MonorailCSS is a utility-first CSS library inspired heavily by Tailwind CSS. It's a JIT CSS compiler written in .NET that aims to be Tailwind CSS 4.3 compatible.

Basic Usage

Given a list of CSS classes, MonorailCSS will produce optimized CSS output.

var framework = new CssFramework();
var css = framework.Process("my-4 mx-4 text-red-500");

Will produce:

.mx-4 {
  margin-left: 1rem;
  margin-right: 1rem;
}
.my-4 {
  margin-bottom: 1rem;
  margin-top: 1rem;
}
.text-red-500 {
  color: var(--color-red-500);
}

You can also process collections of classes:

var classes = new[] { "bg-blue-500", "text-white", "p-4", "rounded-lg" };
var css = framework.Process(classes);

Customizing the Theme

The theme system uses CSS custom properties and can be customized to match your design system:

using System.Collections.Immutable;

// Start with the default theme and customize it
var customTheme = new Theme()
    .AddColorPalette("brand", new Dictionary<string, string>
    {
        { "50", "#eff6ff" },
        { "100", "#dbeafe" },
        { "200", "#bfdbfe" },
        { "300", "#93c5fd" },
        { "400", "#60a5fa" },
        { "500", "#3b82f6" },
        { "600", "#2563eb" },
        { "700", "#1d4ed8" },
        { "800", "#1e40af" },
        { "900", "#1e3a8a" },
        { "950", "#172554" }
    }.ToImmutableDictionary())
    .MapColorPalette("sky", "primary")  // Map 'sky' palette to 'primary'
    .AddFontFamily("display", "'Inter', sans-serif");

var framework = new CssFramework(new CssFrameworkSettings
{
    Theme = customTheme
});

// Now you can use: bg-brand-500, text-primary-600, font-display

Component Classes (Apply)

You can create component classes by applying utility classes to selectors:

using System.Collections.Immutable;

var settings = new CssFrameworkSettings
{
    IncludePreflight = false,
    Applies = new Dictionary<string, string>
    {
        { "body", "font-sans text-gray-900" },
        { ".btn", "px-4 py-2 rounded-lg font-semibold" },
        { ".btn-primary", "bg-blue-500 text-white hover:bg-blue-600" },
        { ".card", "bg-white shadow-lg rounded-xl p-6" }
    }.ToImmutableDictionary()
};

var framework = new CssFramework(settings);
var css = framework.Process("btn btn-primary");

Advanced Features

Custom Variants

Create custom pseudo-classes or selector modifiers:

var settings = new CssFrameworkSettings
{
    CustomVariants = new List<CustomVariantDefinition>
    {
        new() { Name = "scrollbar", Selector = "&::-webkit-scrollbar" },
        new() { Name = "scrollbar-track", Selector = "&::-webkit-scrollbar-track" }
    }.ToImmutableList()
};

var framework = new CssFramework(settings);
// Use: scrollbar:w-2 scrollbar-track:bg-gray-100

Arbitrary Values

MonorailCSS supports arbitrary values in square brackets:

var framework = new CssFramework();
var css = framework.Process("bg-[#1da1f2] text-[14px] w-[500px]");

Preflight CSS

Control whether to include base/reset styles:

var framework = new CssFramework(new CssFrameworkSettings
{
    IncludePreflight = true  // Default is true
});
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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
0.0.5-alpha.0.165 37 6/4/2026
0.0.5-alpha.0.164 38 6/4/2026
0.0.5-alpha.0.163 43 6/3/2026
0.0.5-alpha.0.162 68 5/29/2026
0.0.5-alpha.0.161 68 5/29/2026
0.0.5-alpha.0.159 52 5/28/2026
0.0.5-alpha.0.158 57 5/28/2026
0.0.5-alpha.0.149 52 5/24/2026
0.0.5-alpha.0.148 53 5/24/2026
0.0.5-alpha.0.147 54 5/23/2026
0.0.5-alpha.0.146 52 5/15/2026
0.0.5-alpha.0.143 59 5/12/2026
0.0.5-alpha.0.142 52 5/12/2026
0.0.5-alpha.0.141 57 5/12/2026
0.0.5-alpha.0.137 56 5/11/2026
0.0.5-alpha.0.134 53 5/11/2026
0.0.5-alpha.0.133 50 5/11/2026
0.0.5-alpha.0.131 54 5/11/2026
0.0.5-alpha.0.3 261 10/12/2025
0.0.5-alpha.0.2 151 10/12/2025
Loading failed