string? BaseDirectoryOverride { get; set; }
Source
Gets or sets a directory to override AppContext.BaseDirectory for testing.
Provides extension methods for registering Tailwind CSS services.
IServiceCollection AddTailwind(this IServiceCollection services)
Source
Adds Tailwind CSS services to the service collection.
servicesThe service collection.The service collection for chaining.
Use this overload when the default TailwindOptions are sufficient. It delegates to AddTailwind(IServiceCollection, Action{TailwindOptions}) and registers both TailwindCliManager and the hosted TailwindWatchService. In tests or non-hosted scenarios, remember that the hosted watch service can start background file/process work.
IServiceCollection AddTailwind(this IServiceCollection services, Action<TailwindOptions> configureOptions)
Source
Adds Tailwind CSS services with custom configuration to the service collection.
servicesThe service collection.configureOptionsAn action to configure the TailwindOptions.The service collection for chaining.
Use this overload to customize TailwindOptions before AppSurface registers TailwindCliManager and TailwindWatchService. The watch service is registered as an IHostedService, so hosts that should not run Tailwind background work should avoid this extension or replace the hosted service registration intentionally.
Manages the location and execution of the Tailwind CLI binary.
string GetTailwindPath()
Source
Gets the path to the Tailwind CLI binary.
The absolute path to the tailwindcss executable.
FileNotFoundExceptionThrown if the binary cannot be found in runtimes, local directory, or PATH.AppContext.BaseDirectory.AppContext.BaseDirectory.PATH as an escape hatch for custom or Node-managed Tailwind setups, including Windows shell shims such as .cmd and .ps1.FileNotFoundException.TailwindCliInvocation BuildInvocation(string tailwindPath, IReadOnlyList<string> tailwindArgs)
Source
Builds the process invocation needed to execute a resolved Tailwind CLI path.
tailwindPathThe resolved Tailwind CLI path returned by GetTailwindPath.tailwindArgsThe Tailwind CLI arguments to forward to the process.A TailwindCliInvocation describing the executable to launch and the full ordered argument list.
Windows PATH resolution can return Node-managed shell shims such as .cmd or .ps1. These files cannot be launched reliably with System.Diagnostics.ProcessStartInfo.UseShellExecute disabled, so they are wrapped with cmd.exe or powershell.exe as appropriate.
string GetCurrentRid()
Source
Gets the Runtime Identifier (RID) for the current platform.
The RID string (e.g., "win-x64", "linux-arm64").
Must be kept in sync with the RID logic in the runtime package projects and build/ForgeTrust.AppSurface.Web.Tailwind.targets. Unsupported operating systems or architectures return "unknown". Windows Arm64 intentionally maps to win-x64 because Tailwind v4.1.18 does not ship a native Windows Arm64 standalone binary.
string ResolveRid(OSPlatform osPlatform, Architecture architecture)
Source
Resolves the Tailwind runtime identifier for a specific platform and process architecture.
osPlatformThe operating system platform to evaluate.architectureThe process architecture to map.The Tailwind runtime identifier for the supplied platform/architecture pair.
Must be kept in sync with the RID logic in the runtime package projects and build/ForgeTrust.AppSurface.Web.Tailwind.targets.
string? BaseDirectoryOverride { get; set; }
Source
Gets or sets a directory to override AppContext.BaseDirectory for testing.
string? AssemblyDirectoryOverride { get; set; }
Source
Gets or sets a directory to override the resolved assembly directory for testing isolated fallback lookup.
string? RidOverride { get; set; }
Source
Gets or sets a runtime identifier override for tests that need to exercise non-host RID resolution paths.
Func<OSPlatform, bool>? IsOSPlatformOverride { get; set; }
Source
Gets or sets an operating-system detector override for tests that need deterministic platform simulation.
Func<Architecture>? ProcessArchitectureOverride { get; set; }
Source
Gets or sets a process-architecture override for tests that need deterministic RID resolution.
Represents the concrete process invocation required to launch the resolved Tailwind CLI.
FileNameThe executable or launcher to start.ArgumentsThe complete ordered argument list to pass to FileName.A background service that runs the Tailwind CLI in watch mode during development.
Task<CommandResult> ExecuteTailwindProcessAsync(string fileName, IReadOnlyList<string> args, string workingDirectory, CancellationToken cancellationToken)
Source
Executes the Tailwind CLI process.
fileNameThe path to the executable.argsThe arguments.workingDirectoryThe working directory.cancellationTokenThe cancellation token.The command result returned by the Tailwind CLI process.
Internal virtual to allow mocking in unit tests.
StringComparison GetPathComparison()
Source
Resolves the path-comparison behavior used when validating Tailwind input/output paths.
The string-comparison behavior used when evaluating Tailwind input and output paths.
The default implementation only assumes case-insensitive paths on Windows so development hosts on case-sensitive volumes are not rejected by a false positive same-file check. Override HostPathsAreCaseInsensitive in tests or specialized hosts that know they should compare paths case-insensitively on another platform.
bool HostPathsAreCaseInsensitive()
Source
Determines whether the current host should treat filesystem paths as case-insensitive for Tailwind path validation.
true when the host should conservatively compare input and output paths case-insensitively; otherwise false.
The default behavior treats only Windows as case-insensitive. Hosts that run on a known case-insensitive non-Windows volume can override this method to opt into StringComparison.OrdinalIgnoreCase.
Configuration options for the Tailwind CSS integration.
services.AddTailwind(...) to control both build-time compilation and development watch behavior. Defaults: Enabled defaults to true.InputPath defaults to wwwroot/css/app.css.OutputPath defaults to wwwroot/css/site.gen.css.bool Enabled { get; set; }
Source
Gets or sets a value indicating whether Tailwind CSS integration is enabled.
Leave this enabled for normal development and build pipelines. Set it to false only when a host intentionally opts out of Tailwind compilation or provides CSS through another mechanism.
string InputPath { get; set; }
Source
Gets or sets the path to the input CSS file.
Defaults to wwwroot/css/app.css. The value should be a non-empty relative path to a readable .css file under the application content root.
string OutputPath { get; set; }
Source
Gets or sets the path to the output CSS file.
Defaults to wwwroot/css/site.gen.css. The value should be a non-empty relative path whose parent directory exists and is writable. Keep the output under wwwroot/ when the generated stylesheet needs to participate in ASP.NET Core static web asset discovery for build and publish output. Avoid pointing this at the same file as InputPath.