MonorailCss

This is the human-readable landing page. If you're an LLM or other automated consumer, fetch /llms.txt instead — it's a structured index of every doc page with per-page markdown sidecars at /_llms/...md. The marketing UI below is not visible to you in extraction.

What MonorailCss does

A JIT CSS compiler for .NET that aims to be Tailwind CSS 4.2 compatible. Hand CssFramework.Process a list of utility class names and it returns the CSS those classes need — including theme variables, preflight reset, variants, breakpoints, dark mode, arbitrary [value]s, opacity modifiers, and trailing ! for important. In-process, no Node toolchain.

Install

dotnet add package MonorailCss

Hello world

using MonorailCss;

var framework = new CssFramework();
var css = framework.Process("flex gap-4 p-6 bg-blue-500 text-white");

Where to go next

  • /llms.txt — structured index of the whole site for LLMs.
  • Getting started — installation, first stylesheet, variants, important, arbitrary values.
  • API reference — public types and method signatures populated from xmldoc.
  • /utility/llms.txt — every utility class grouped by category, with the generated CSS.
Tailwind 4.3 · JIT · Pure C#

Ship Tailwind CSS without the toolchain.

MonorailCSS is a Tailwind-compatible JIT compiler written in pure .NET. Compile utilities at runtime, in-process, with zero npm.

0 npm deps
~12ms cold compile
1.4k+ utilities
9, 10 .NET versions
Program.cs C#
using MonorailCss;

// 1. configure once
var framework = new CssFramework();

// 2. point it at your markup
var css = framework.Process("flex gap-4 p-6 bg-primary-500");

// 3. ship the bytes
File.WriteAllText("site.css", css);
Compiled 4 utilities in 11ms
Works with ASP.NET Core · Blazor · Razor Pages · MAUI
Why MonorailCSS

A first-class CSS pipeline, in the language you already use.

Every feature you expect from Tailwind, expressed as idiomatic .NET. No build orchestration, no JS dependencies, no cognitive context-switch.

.NET-native, end to end

Pure C# — no Node, no shelling out, no JS interop. Reference a NuGet package and compile inline.

Tailwind 4.3 compatible

Same utility names, same variants, same arbitrary-value syntax. Bring your existing markup unchanged.

Just-in-time

Scans your content, emits only what you used. Cold compiles in ~12ms; hot rebuilds are sub-millisecond.

Built for ASP.NET

Drop-in middleware for runtime CSS, MSBuild task for build-time output, source-generator-friendly.

Theme-able by config

Override colors, spacing, breakpoints with a single ITheme. Add custom utilities and variants from C#.

Tiny & dependency-free

One assembly, zero external runtime deps. AOT-friendly. Trims well. Ships clean.

Try it

Type utilities. Watch CSS appear.

The same JIT engine that powers your build, running in your browser. Edit the input — the compiled CSS updates live.

Input — utility classes
flex items-center gap-4 px-6 py-4 rounded-xl bg-primary-500 text-white hover:bg-primary-600
Preview
Preview element
Output — generated CSS 23 lines · ~7ms
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.gap-4 {
  gap: 1rem;
}
.px-6 {
  padding-inline: 1.5rem;
}
.py-4 {
  padding-block: 1rem;
}
.rounded-xl {
  border-radius: 0.75rem;
}
.bg-primary-500 {
  background-color: oklch(64% 0.123 52.073);
}
.text-white {
  color: #fff;
}
.hover\:bg-primary-600:hover {
  background-color: oklch(56% 0.129 52.073);
}
Get going

Three steps from dotnet add to shipping CSS.

Install the NuGet package, instantiate the framework, and you're generating utility CSS — at build time, runtime, or both.

01 Add the package
dotnet add package MonorailCss
02 Create a framework
var fx = new CssFramework();
var css = fx.Process("p-6 bg-primary-500");
03 Wire it up
app.UseMonorail(opts => {
    opts.ContentRoots = ["Pages", "Views"];
});
Open source · MIT

Bring Tailwind home to .NET.

Read the docs, scan the source, file an issue. Contributions welcome.