TailwindCSS.Blazor
1.0.18
dotnet add package TailwindCSS.Blazor --version 1.0.18
NuGet\Install-Package TailwindCSS.Blazor -Version 1.0.18
<PackageReference Include="TailwindCSS.Blazor" Version="1.0.18" />
<PackageVersion Include="TailwindCSS.Blazor" Version="1.0.18" />
<PackageReference Include="TailwindCSS.Blazor" />
paket add TailwindCSS.Blazor --version 1.0.18
#r "nuget: TailwindCSS.Blazor, 1.0.18"
#:package TailwindCSS.Blazor@1.0.18
#addin nuget:?package=TailwindCSS.Blazor&version=1.0.18
#tool nuget:?package=TailwindCSS.Blazor&version=1.0.18
TailwindCSS.Blazor
A .NET library that integrates Tailwind CSS CLI with Blazor applications, featuring automatic hot-reload functionality.
How it works
This package implements hot-reload by fetching CSS and injecting it into a style tag while removing the old link tag. Sometimes when viewing the Elements panel in Chrome, these style tags may not be visible because when .NET hot reload is working correctly, it overwrites the header - this doesn't affect functionality.
Additionally, if .NET hot reload isn't working, this package will continue creating new style tags ensuring that app.css hot reload still functions properly.
Features
- Hot-reload support for development on blazor Interactive Auto mode
Installation
## Project Structure Overview
Blazor1/
├─ Blazor1/
│ ├─ Blazor1.csproj <--- 4 intall nuget package
│ ├─ app.css <--- 1 add this file
│ ├─ Component/
│ │ └─ App.razor <--- 5,6 add style & hot reload script
│ │....
│ ├─ Program.cs <--- 7 add code for run cli & integrated hot reload when run
│ └─ wwwroot
├─ Blazor1.Client/
│ ├─ Blazor1.Client.csproj
│ │....
│ └─ wwwroot
├─ tailwind.config.js <---- 2 add this file
├─ package.json <---- 3 install npm package
└─ node_modules/
- add new
app.cssfile to a root project and fill the following code
@import "tailwindcss";
- At parent folder (folder that contain folder Blazor1 and Blazor1.Client) add
tailwind.config.jsfile to a root project and fill the following code
module.exports = {
content: [
"./**/*.html",
"./**/*.razor",
"./**/*.cshtml",
"./**/*.js",
"./**/*.ts",
],
theme: {
extend: {},
},
plugins: [],
}
- Ensure
nodejsis installed. At root install package
npm install tailwindcss @tailwindcss/cli
- Install this package via NuGet
dotnet add package TailwindCSS.Blazor
- At
App.razorfile, add<link rel="stylesheet" href="@Assets["css/app.css"]"/>before</head>tag
<head>
....
<link rel="stylesheet" href='@Assets['app.css"]'/>
</head>
- At
App.razorfile, add<script src="_content/TailwindCSS.Blazor/tailwindcss-blazor-hot-reload.js"></script>before</body>tag
<body>
....
<script src="_framework/blazor.web.js"></script>
<script src="_content/TailwindCSS.Blazor/tailwindcss-blazor-hot-reload.js"></script>
</body>
- At
Program.csof web project add two lines
builder.AddTailwindCSS(); // <-- add this line
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseTailwindCSS(); // <-- add this line
app.UseWebAssemblyDebugging();
}
- Run a Blazor project. (can run with F5 or by
dotnet runcommand) - Change
app.cssfile or razor file. The tailwind-cli will output towwwroot/css/app.cssand it will auto hot reload via websocket.
Tailwind Configuration
You can configure Tailwind CSS settings in the tailwind.config.js file.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.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.0.18 | 275 | 9/6/2025 |