string? BaseDirectoryOverride { get; set; }
Source
Gets or sets a base directory override used by isolated tests.
Resolves the Tailwind CLI used by development watch mode.
Normal resolution uses the same package-pinned manifest and verified host cache as the MSBuild task. This manager is intentionally the only place that may make the development-only PATH
fallback after an availability-related verified-resolution failure. A manifest, cache, or digest integrity failure never falls back to PATH
. Build mode uses TailwindCliResolver
directly and never searches PATH
.
string GetTailwindPath()
Resolves a verified host-cache executable, then makes one development-only PATH attempt only for an availability failure.
The absolute path or launcher path for development watch mode.
FileNotFoundException
Task<string> GetTailwindPathAsync(CancellationToken cancellationToken)
Resolves a verified host-cache executable, then makes one development-only PATH attempt only for an availability failure.
cancellationToken
The absolute path or launcher path for development watch mode.
FileNotFoundException
Watch hosts should prefer this asynchronous method so shutdown can cancel a cold-cache acquisition. The synchronous GetTailwindPath
wrapper remains for existing callers that cannot await resolution, but can block while it waits for cache ownership or an official-release retry.
bool CanUseDevelopmentPathFallback(TailwindCliResolutionFailure failure)
Determines whether a failed verified resolution is an availability condition for which watch mode may use its unverified development fallback.
failure
true
only for availability failures. Manifest, cache, path, checksum, and size-limit trust-boundary failures never permit the unverified development-path fallback.
TailwindCliInvocation BuildInvocation(string tailwindPath, IReadOnlyList<string> tailwindArgs)
Builds the invocation needed to execute a resolved CLI path.
tailwindPath
tailwindArgs
A direct executable or shell-shim invocation.
string GetCurrentRid()
Gets the supported Tailwind RID for the current process host.
string ResolveRid(OSPlatform osPlatform, Architecture architecture)
Maps an operating system and architecture pair to a Tailwind host RID.
string? BaseDirectoryOverride { get; set; }
Source
Gets or sets a base directory override used by isolated tests.
string? RidOverride { get; set; }
Source
Gets or sets a host RID override used only by isolated tests.
string? DownloadCacheRootOverride { get; set; }
Source
Gets or sets a cache-root override used by isolated tests.
string? ReleaseManifestPathOverride { get; set; }
Source
Gets or sets a release-manifest path override used by isolated tests.
Func<Uri, CancellationToken, Task<byte[]>>? DownloadOverride { get; set; }
Source
Gets or sets an official-release download seam used by isolated tests.
Func<OSPlatform, bool>? IsOSPlatformOverride { get; set; }
Source
Gets or sets a platform detector override used by isolated tests.
Func<Architecture>? ProcessArchitectureOverride { get; set; }
Source
Gets or sets a process-architecture override used by isolated tests.
Represents the concrete process invocation required to launch the resolved Tailwind CLI.
FileName
Arguments
FileName
.Provides extension methods for registering Tailwind CSS services.
IServiceCollection AddTailwind(this IServiceCollection services)
Adds Tailwind CSS services to the service collection.
services
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)
Adds Tailwind CSS services with custom configuration to the service collection.
services
configureOptions
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.
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
.CliPath
defaults to null
, which uses the verified host cache and may use the development PATH
fallback only after an availability failure.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
.
string? CliPath { get; set; }
Source
Gets or sets an explicit Tailwind CLI path for development watch mode.
When this value is set, watch mode launches this binary instead of probing the verified host cache or the development PATH
. Relative paths are resolved against the application content root. Use this for custom standalone Tailwind binaries or plugin-heavy setups that are managed outside the AppSurface host cache. Build mode uses the MSBuild TailwindCliPath
property for the same concept.
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)
Executes the Tailwind CLI process.
fileName
args
workingDirectory
cancellationToken
The command result returned by the Tailwind CLI process.
Internal virtual to allow mocking in unit tests.
StringComparison GetPathComparison()
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()
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
.