AppSurface Search
API Reference

Tailwind

Namespaces

Type

TailwindOptions

Source

Configuration options for the Tailwind CSS integration.

Remarks

Use these options with 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.
Paths are resolved relative to the app content root. Common misconfigurations include pointing at a missing input file, using whitespace-only paths, or choosing an output path whose parent directory is not writable.
Property

Enabled

bool Enabled { get; set; } Source

Gets or sets a value indicating whether Tailwind CSS integration is enabled.

Remarks

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.

Property

InputPath

string InputPath { get; set; } Source

Gets or sets the path to the input CSS file.

Remarks

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.

Property

OutputPath

string OutputPath { get; set; } Source

Gets or sets the path to the output CSS file.

Remarks

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.

Property

CliPath

string? CliPath { get; set; } Source

Gets or sets an explicit Tailwind CLI path for development watch mode.

Remarks

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.

Type

TailwindWatchService

Source

A background service that runs the Tailwind CLI in watch mode during development.

Method

ExecuteTailwindProcessAsync

Task<CommandResult> ExecuteTailwindProcessAsync(string fileName, IReadOnlyList<string> args, string workingDirectory, CancellationToken cancellationToken) Source

Executes the Tailwind CLI process.

Parameters

  • fileNameThe path to the executable.
  • argsThe arguments.
  • workingDirectoryThe working directory.
  • cancellationTokenThe cancellation token.

Returns

The command result returned by the Tailwind CLI process.

Remarks

Internal virtual to allow mocking in unit tests.

Method

GetPathComparison

StringComparison GetPathComparison() Source

Resolves the path-comparison behavior used when validating Tailwind input/output paths.

Returns

The string-comparison behavior used when evaluating Tailwind input and output paths.

Remarks

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.

Method

HostPathsAreCaseInsensitive

bool HostPathsAreCaseInsensitive() Source

Determines whether the current host should treat filesystem paths as case-insensitive for Tailwind path validation.

Returns

true when the host should conservatively compare input and output paths case-insensitively; otherwise false.

Remarks

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.

Type

TailwindCliManager

Source

Resolves the Tailwind CLI used by development watch mode.

Remarks

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.

Method

GetTailwindPath

string GetTailwindPath() Source

Resolves a verified host-cache executable, then makes one development-only PATH attempt only for an availability failure.

Returns

The absolute path or launcher path for development watch mode.

Exceptions

  • FileNotFoundExceptionThrown when neither verified resolution nor PATH yields a CLI.
Method

GetTailwindPathAsync

Task<string> GetTailwindPathAsync(CancellationToken cancellationToken) Source

Resolves a verified host-cache executable, then makes one development-only PATH attempt only for an availability failure.

Parameters

  • cancellationTokenCancellation for cache locking, downloads, and retry delays.

Returns

The absolute path or launcher path for development watch mode.

Exceptions

  • FileNotFoundExceptionThrown when neither verified resolution nor PATH yields a CLI.

Remarks

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.

Method

CanUseDevelopmentPathFallback

bool CanUseDevelopmentPathFallback(TailwindCliResolutionFailure failure) Source

Determines whether a failed verified resolution is an availability condition for which watch mode may use its unverified development fallback.

Parameters

  • failureThe verified-resolution failure classification.

Returns

true only for availability failures. Manifest, cache, path, checksum, and size-limit trust-boundary failures never permit the unverified development-path fallback.

Method

BuildInvocation

TailwindCliInvocation BuildInvocation(string tailwindPath, IReadOnlyList<string> tailwindArgs) Source

Builds the invocation needed to execute a resolved CLI path.

Parameters

  • tailwindPathThe resolved executable or Windows shell shim path.
  • tailwindArgsOrdered Tailwind arguments.

Returns

A direct executable or shell-shim invocation.

Method

GetCurrentRid

string GetCurrentRid() Source

Gets the supported Tailwind RID for the current process host.

Method

ResolveRid

string ResolveRid(OSPlatform osPlatform, Architecture architecture) Source

Maps an operating system and architecture pair to a Tailwind host RID.

Property

BaseDirectoryOverride

string? BaseDirectoryOverride { get; set; } Source

Gets or sets a base directory override used by isolated tests.

Property

RidOverride

string? RidOverride { get; set; } Source

Gets or sets a host RID override used only by isolated tests.

Property

DownloadCacheRootOverride

string? DownloadCacheRootOverride { get; set; } Source

Gets or sets a cache-root override used by isolated tests.

Property

ReleaseManifestPathOverride

string? ReleaseManifestPathOverride { get; set; } Source

Gets or sets a release-manifest path override used by isolated tests.

Property

DownloadOverride

Func<Uri, CancellationToken, Task<byte[]>>? DownloadOverride { get; set; } Source

Gets or sets an official-release download seam used by isolated tests.

Property

IsOSPlatformOverride

Func<OSPlatform, bool>? IsOSPlatformOverride { get; set; } Source

Gets or sets a platform detector override used by isolated tests.

Property

ProcessArchitectureOverride

Func<Architecture>? ProcessArchitectureOverride { get; set; } Source

Gets or sets a process-architecture override used by isolated tests.

Type

TailwindCliInvocation

Source

Represents the concrete process invocation required to launch the resolved Tailwind CLI.

Parameters

  • FileNameThe executable or launcher to start.
  • ArgumentsThe complete ordered arguments to pass to FileName.
Type

TailwindExtensions

Source

Provides extension methods for registering Tailwind CSS services.

Method

AddTailwind

2 overloads
IServiceCollection AddTailwind(this IServiceCollection services) Source

Adds Tailwind CSS services to the service collection.

Parameters

  • servicesThe service collection.

Returns

The service collection for chaining.

Remarks

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.

Parameters

  • servicesThe service collection.
  • configureOptionsAn action to configure the TailwindOptions.

Returns

The service collection for chaining.

Remarks

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.