Core TailwindCSS compilation library that wraps the standalone TailwindCSS CLI. This is an internal library bundled with the main NuGet package - not published separately.
DotnetDevKR.TailwindCSS.Compile.csproj- Library project definition- Targets .NET 6.0
- Uses
RootNamespace="DotnetDevKR.TailwindCSS"(shared namespace) SuppressDependenciesWhenPacking=true(no transitive deps)
TailwindCSSCompiler.cs- Core compiler implementationCompileAsync()- Main compilation methodCreateTailwindCSSProcess()- Process setup for TailwindCSS CLIGetExecutablePath()- Platform-specific executable resolution
None.
CompileAsync()
↓
CreateTailwindCSSProcess()
↓ (builds command with arguments)
GetExecutablePath()
↓ (resolves OS/arch specific binary)
Process.Start()
↓
await WaitForExitAsync()
The GetExecutablePath() method supports:
| OS | Architecture | Executable |
|---|---|---|
| Windows | x64 | runtime\tailwindcss-windows-x64.exe |
| Windows | arm64 | runtime\tailwindcss-windows-arm64.exe |
| Linux | x64 | runtime/tailwindcss-linux-x64 |
| Linux | arm64 | runtime/tailwindcss-linux-arm64 |
| macOS | x64 | runtime/tailwindcss-macos-x64 |
| macOS | arm64 | runtime/tailwindcss-macos-arm64 |
The compiler builds arguments like:
-i {InputFilename} -o {OutputFilename} --cwd {ProjectDir} [--minify] [--map]
-i- Input CSS file-o- Output CSS file--cwd- Working directory (for finding tailwind.config.js)--minify- Enable CSS minification--map- Generate source maps (debug mode)
Non-zero exit codes throw exceptions with stderr content. The MSBuild task catches these and reports via Log.HasLoggedErrors.
- Add case to
GetExecutablePath()switch statement - Add executable to
install.shFILES array - Ensure executable is included in package (check
.csproj)
System.Diagnostics.Processfor CLI invocationSystem.Runtime.InteropServices.RuntimeInformationfor platform detection