### Docker Base Image Examples Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md Examples of Docker `FROM` instructions for different Linux distributions and libc variants. This influences which Tailwind.Standalone binary is downloaded. ```dockerfile # Alpine (Linux, musl, x64) FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine # → Tailwind.Standalone downloads the musl binary # Ubuntu (Linux, glibc, x64) FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy # → Tailwind.Standalone downloads the glibc binary ``` -------------------------------- ### Full MSBuild Configuration Example Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/INDEX.md This example demonstrates a comprehensive configuration of all available MSBuild properties for the Tailwind CSS integration. It covers versioning, paths, optimization, source maps, and custom download URLs. ```xml 3.2.4 ./input.css ./output.css ./.tailwind true true true ./output.css.map https://github.com/tailwindlabs/tailwindcss-builds/releases/download ``` -------------------------------- ### GitHub Actions Runner Examples Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md Examples of GitHub Actions `runs-on` configurations for different operating systems and architectures. These determine which Tailwind.Standalone binary is downloaded. ```yaml # Ubuntu (Linux x64, glibc) runs-on: ubuntu-latest # → Downloads tailwindcss-linux-x64 # Ubuntu ARM64 runs-on: ubuntu-latest-arm64 # → Downloads tailwindcss-linux-arm64 # macOS Intel runs-on: macos-12 # → Downloads tailwindcss-macos-x64 # macOS Apple Silicon runs-on: macos-14 # → Downloads tailwindcss-macos-arm64 # Windows x64 runs-on: windows-latest # → Downloads tailwindcss-windows-x64.exe # Windows ARM64 runs-on: windows-latest-arm64 # → Downloads tailwindcss-windows-arm64.exe ``` -------------------------------- ### Verify Tailwind.Standalone Setup Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md Execute these commands sequentially to clean previous builds, check for the input CSS file, build the project, and verify the generated output CSS file. ```bash # 1. Clean previous builds dotnet clean ``` ```bash # 2. Check that input file exists ls -la Styles/input.css ``` ```bash # 3. Build and check for CSS output dotnet build ``` ```bash # 4. Verify output file was created ls -la wwwroot/css/output.css ``` ```bash # 5. Check that CSS content is not empty cat wwwroot/css/output.css | head -20 ``` -------------------------------- ### Install Tailwind.Standalone Package Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/README.md Add the Tailwind.Standalone NuGet package to your .NET project using the dotnet CLI. ```shell dotnet add package MarshalHayes.Tailwind.Standalone ``` -------------------------------- ### Docker Usage for Alpine Linux Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md This Dockerfile example shows how to set up a .NET 8 SDK environment on Alpine Linux, which uses musl. Tailwind.Standalone will automatically download the correct musl binary. ```dockerfile FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine # Alpine uses musl; Tailwind.Standalone automatically downloads the musl binary WORKDIR /app COPY . . RUN dotnet build ``` -------------------------------- ### Tailwind Compilation with Minification and Optimization Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-targets.md Example command for Tailwind CLI that includes flags for optimizing and minifying the output CSS. Use this when aiming for smaller file sizes and improved performance. ```powershell "C:\Users\user\.cache\Tailwind\v4.0.14\tailwindcss-windows-x64.exe" -i "Styles/main.css" -o "wwwroot/main.css" --optimize --minify ``` -------------------------------- ### Docker Build for .NET Project with Tailwind Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md This Dockerfile sets up a build environment for a .NET project, installs the Tailwind Standalone package, and compiles the project. The compiled CSS will be in the output directory after the build. ```dockerfile FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY . . # Install the package and build RUN dotnet add package MarshalHayes.Tailwind.Standalone RUN dotnet build -c Release # The compiled CSS is now available in the output directory ``` -------------------------------- ### Basic Tailwind Compilation Command Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-targets.md Example of a basic Tailwind CLI command for compiling a CSS file. This command is used when no additional options like optimization or minification are required. ```powershell "C:\Users\user\.cache\Tailwind\v4.0.14\tailwindcss-windows-x64.exe" -i "Styles/main.css" -o "wwwroot/main.css" ``` -------------------------------- ### CI/CD Integration with GitHub Actions Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/INDEX.md This example shows how to integrate Tailwind CSS builds into a GitHub Actions workflow. It ensures that Tailwind CSS is downloaded and processed as part of your continuous integration pipeline. ```yaml name: Build Tailwind CSS on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: '7.0.x' - name: Build with Tailwind CSS run: dotnet build --configuration Release ``` -------------------------------- ### Run Project with Hot Reload Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/00-START-HERE.txt Use dotnet watch run to start your application with hot reload enabled. Simultaneously, use dotnet watch msbuild to monitor for changes and trigger Tailwind rebuilds. ```bash Terminal 1: $ dotnet watch run Terminal 2: $ dotnet watch msbuild /t:Tailwind ``` -------------------------------- ### Conditional Flags for Tailwind CSS CLI Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md Provides examples of conditional flags that can be appended to the Tailwind CSS CLI command based on build variables. ```string --optimize ``` ```string --minify ``` ```string --map "{path}" ``` -------------------------------- ### Tailwind Compilation with External Source Map Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-targets.md Example command for Tailwind CLI that generates an external source map file. This is useful for debugging compiled CSS in development environments. ```powershell "/home/user/.cache/Tailwind/v4.0.14/tailwindcss-linux-x64" -i "Styles/main.css" -o "wwwroot/main.css" --map "wwwroot/main.css.map" ``` -------------------------------- ### Create Tailwind Input Stylesheet Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md Create the input stylesheet file and directory if it does not exist to resolve the 'Tailwind input stylesheet does not exist' error. ```bash # Create the directory and file mkdir -p Styles echo '@tailwind base; @tailwind components; @tailwind utilities;' > Styles/input.css ``` -------------------------------- ### Manual Invocation of DownloadTailwind Target Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-targets.md Demonstrates how to manually invoke the 'DownloadTailwind' MSBuild target from the command line to download the Tailwind CLI for the current platform. It also shows how to trigger the full 'Tailwind' target, which depends on 'DownloadTailwind'. ```bash # Download Tailwind for current platform dotnet msbuild /t:DownloadTailwind # Download and run the full Tailwind target dotnet msbuild /t:Tailwind ``` -------------------------------- ### Run Application and Watch CSS Changes Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md This recommended approach involves running the application with hot reload and watching the Tailwind build process in separate terminals for comprehensive updates. ```bash # Terminal 1: Run the application dotnet watch run # Terminal 2: Rebuild CSS on input changes dotnet watch msbuild /t:Tailwind ``` -------------------------------- ### Verify .NET Runtime Architecture Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md Check the .NET runtime information to ensure it's native ARM64 on macOS. This is relevant for 'Invalid format' errors on Apple Silicon. ```bash dotnet --info # Look for "Architecture" and "OS Platform" ``` -------------------------------- ### Multiple Input/Output Pairs Configuration Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/configuration.md Configures separate input and output paths for multiple stylesheets, allowing for distinct compilation processes. ```xml v4.0.14 Styles/main.css wwwroot/css/main.css Styles/admin.css wwwroot/css/admin.css ``` -------------------------------- ### Verify Architecture on macOS Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md Use this command to check the system architecture on macOS. This helps diagnose issues where the Intel binary is downloaded instead of ARM64. ```bash uname -m # Should output: arm64 ``` -------------------------------- ### Production Optimized Build Configuration Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/configuration.md Optimizes and minifies CSS for production deployment, ensuring smaller file sizes and faster loading. ```xml v4.0.14 Styles/input.css wwwroot/css/output.min.css true true ``` -------------------------------- ### Download Tailwind CLI Binary Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-targets.md This target downloads the Tailwind CLI binary, caches it locally, and sets executable permissions on Unix-like systems. It determines the correct binary name based on OS and architecture, constructs download URLs, and uses the 'DownloadFile' task. Downloads are skipped if the binary already exists and the version is not 'latest'. ```msbuild tailwindcss-windows-$(TargetArchitecture).exe tailwindcss-linux-$(TargetArchitecture)$(IsMusl.ToLower() == 'true' ? '-musl' : '') tailwindcss-macos-$(TargetArchitecture) $(ArtifactsLocation)/Tailwind/$(TailwindVersion) $(TailwindDestinationFolder)/$(TailwindReleaseName) https://github.com/tailwindlabs/tailwindcss/releases/latest/download/$(TailwindReleaseName) https://github.com/tailwindlabs/tailwindcss/releases/download/$(TailwindVersion)/$(TailwindReleaseName) ``` -------------------------------- ### DownloadFile Task Configuration for Tailwind CSS Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md Shows the XML configuration for the DownloadFile task, specifying destination, source, and conditions for downloading Tailwind CSS binaries. ```xml ``` -------------------------------- ### Manually Set Executable Permissions on Unix Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md Use these commands to verify the Tailwind.Standalone binary exists and to manually set executable permissions on Linux and macOS. This resolves 'Binary not executable' errors. ```bash ls -la ~/.cache/Tailwind/v4.0.14/ chmod +x ~/.cache/Tailwind/v4.0.14/tailwindcss-linux-x64 ``` -------------------------------- ### Minimal .csproj Configuration Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/INDEX.md This snippet shows the essential configuration required in your .csproj file to integrate the Tailwind CSS MSBuild package. It includes the necessary ItemGroup for defining input and output stylesheet paths. ```xml ``` -------------------------------- ### Normalize Path in MSBuild Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md Demonstrates how to normalize a path using MSBuild's NormalizePath function. This ensures consistent path formatting across different platforms by converting backslashes to forward slashes and resolving relative path components. ```xml $([MSBuild]::NormalizePath('$(TailwindCliPath)')) ``` -------------------------------- ### Constructing Tailwind CSS CLI Command Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md Demonstrates the base structure for constructing a Tailwind CSS CLI command, including placeholders for input, output, and optional flags. ```string "{TailwindCliPath}" -i "{input}" -o "{output}" ``` -------------------------------- ### Development with Hot Reload using dotnet watch Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/README.md Use these commands to simultaneously run your application with hot reload and rebuild CSS on input changes during development. ```bash # Terminal 1: Run application dotnet watch run # Terminal 2: Rebuild CSS on input changes dotnet watch msbuild /t:Tailwind ``` -------------------------------- ### Make Binary Executable on Linux Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md This bash command shows how to make the downloaded Tailwind.Standalone binary executable on Linux systems. This is typically handled automatically by Tailwind.Standalone. ```bash chmod +x '{binary-path}' ``` -------------------------------- ### DownloadTailwind Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/DOCUMENTATION_MANIFEST.txt Downloads the specified version of the Tailwind CSS CLI binary to the configured download path. ```APIDOC ## DownloadTailwind ### Description Downloads the Tailwind CSS CLI executable for the current platform and the specified version. It utilizes the `TailwindDownloadUrl` and `TailwindDownloadPath` properties. ### Method MSBuild Target ### Endpoint N/A (MSBuild Target) ### Parameters #### Required MSBuild Properties - **TailwindVersion** (string) - Required - The version of Tailwind CSS to download. #### Optional MSBuild Properties - **TailwindDownloadPath** (string) - Optional - The directory where Tailwind binaries should be downloaded. Defaults to a package-specific location. - **TailwindDownloadUrl** (string) - Optional - A custom URL to download Tailwind binaries from. If not provided, a default URL is used. ### Request Example ```xml 3.0.0 $(MSBuildProjectDirectory)/tools ``` ### Response #### Success Response MSBuild target execution completes. The Tailwind CSS CLI binary is downloaded to the specified or default path. #### Response Example N/A (MSBuild Target) ``` -------------------------------- ### Specify Tailwind Download Path Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md Explicitly set the `TailwindDownloadPath` in your .csproj file when the system cannot determine a default cache directory. ```xml /tmp/tailwind ``` -------------------------------- ### Add Tailwind.Standalone to .csproj Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md Include the Tailwind.Standalone package reference directly in your .csproj file. ```xml ``` -------------------------------- ### Configure Custom Download URL for Tailwind CLI Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md Use a mirrored or private copy of the Tailwind CLI by specifying a custom download URL. The URL must point directly to the binary file. ```xml v4.0.14 Styles/input.css wwwroot/css/output.css https://internal-cdn.example.com/tailwindcss-windows-x64.exe ``` -------------------------------- ### Detect Operating System with .NET Runtime APIs Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md Uses .NET runtime APIs to conditionally execute targets based on the operating system. Supports Linux, macOS, and Windows detection. ```xml ``` -------------------------------- ### Configure Output Stylesheet Path Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-properties.md Specify the destination path for the compiled Tailwind CSS output. The build fails if this property is empty. ```xml wwwroot/main.css ``` -------------------------------- ### Configure Input Stylesheet Path Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-properties.md Define the path to the input Tailwind CSS stylesheet. This file must exist before the build. Modifying this file triggers rebuilds when using 'dotnet watch'. ```xml Styles/main.css ``` -------------------------------- ### Development Configuration with Source Maps Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/configuration.md Enables source map generation for debugging CSS in browser DevTools during development. ```xml latest Styles/input.css wwwroot/css/output.css true wwwroot/css/output.css.map ``` -------------------------------- ### Detect CPU Architecture with RuntimeInformation Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md Uses System.Runtime.InteropServices.RuntimeInformation to detect the CPU architecture. Supports detection for x64 and Arm64 architectures. ```xml ``` -------------------------------- ### Configure Absolute Paths for Tailwind CSS Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/configuration.md Define absolute paths for input and output stylesheets. Use this when relative paths are not suitable. ```xml /opt/myapp/styles/input.css /opt/myapp/wwwroot/css/output.css ``` -------------------------------- ### GitHub Actions CI/CD Workflow for .NET Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md This GitHub Actions workflow automates the build process for a .NET project, including Tailwind compilation. Ensure your project is configured to trigger Tailwind builds during `dotnet build`. ```yaml name: Build on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: '8.0' - name: Restore run: dotnet restore - name: Build run: dotnet build --configuration Release ``` -------------------------------- ### Detect Linux Architecture (uname) Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md Use the 'uname -m' command in bash to check the machine hardware name, indicating the architecture on Linux. 'x86_64' signifies x64, and 'aarch64' signifies ARM64. ```bash # Check architecture uname -m # Output: x86_64 (x64) or aarch64 (ARM64) ``` -------------------------------- ### Build Project with Tailwind Compilation Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/00-START-HERE.txt Execute the dotnet build command to trigger the Tailwind CSS compilation as part of your project's build process. ```bash dotnet build ``` -------------------------------- ### Development with `dotnet watch` Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/INDEX.md This command enables hot-reloading for your Tailwind CSS during development. It watches for changes in your input CSS file and automatically rebuilds the output when modifications are detected. ```bash dotnet watch --project "./YourProject.csproj" hot-reload ``` -------------------------------- ### Check libc Type on Linux Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md Check your system's libc type using `ldd --version` to diagnose issues with incorrect binary downloads on Linux. ```bash # Check which libc you have ldd --version ``` -------------------------------- ### Linux Libc Detection Logic Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md This XML snippet demonstrates how to detect the C standard library type (glibc or musl) on Linux by executing 'ldd --version' and checking its output. ```xml true ``` -------------------------------- ### Windows Default Download Path Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/configuration.md The default location where Tailwind binaries are cached on Windows systems. ```text %LOCALAPPDATA%\Tailwind\{version}\ ``` -------------------------------- ### Configure Relative Paths for Tailwind CSS Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/configuration.md Define relative paths for input and output stylesheets. This is the recommended approach for most projects. ```xml Styles/input.css wwwroot/css/output.css ``` -------------------------------- ### Manual Download Target Invocation Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/INDEX.md This command allows you to manually trigger the download of the Tailwind CSS CLI binary. This can be useful for debugging or ensuring the binary is cached before a build. ```bash dotnet build --target DownloadTailwind ``` -------------------------------- ### NuGet Package Metadata for Build Integration Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md Configure NuGet package behavior to prevent assembly builds and exclude build artifacts, while ensuring the `.targets` file is imported. ```xml true false ``` -------------------------------- ### Configure .csproj for Tailwind Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/00-START-HERE.txt Add a PropertyGroup to your .csproj file to configure Tailwind CSS build properties like version and file paths. ```xml v4.0.14 Styles/input.css wwwroot/css/output.css ``` -------------------------------- ### Run Application with Hot Reload Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md Use this command to run your application with hot reload for C# changes. CSS changes will not trigger rebuilds with this option. ```bash dotnet watch run ``` -------------------------------- ### Use Latest Tailwind CSS Version Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/configuration.md Use the 'latest' keyword to automatically use the newest release. Note that this adds network latency to every build and is not recommended for CI/CD. ```xml latest ``` -------------------------------- ### Tailwind CSS Download Cache Structure Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md Illustrates the directory structure for caching different versions of the Tailwind CSS binary, including a 'latest' symlink. ```text {TailwindDownloadPath}/ └── Tailwind/ ├── v4.0.13/ │ └── tailwindcss-windows-x64.exe ├── v4.0.14/ │ └── tailwindcss-windows-x64.exe └── latest/ └── tailwindcss-windows-x64.exe ``` -------------------------------- ### Make Tailwind CLI Executable on Unix-like Systems Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md Conditionally executes the 'chmod +x' command to make the Tailwind CLI binary executable on Linux and macOS. This ensures the downloaded binary can be run directly. ```xml ``` -------------------------------- ### Detect macOS Architecture (uname) Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md Use the 'uname -m' command on macOS to identify the architecture. 'x86_64' indicates an Intel processor, while 'arm64' indicates Apple Silicon. ```bash # Check architecture uname -m # Output: x86_64 (Intel) or arm64 (Apple Silicon) ``` -------------------------------- ### Verify libc Type on Linux Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md Use this command to check the libc variant on Linux systems. This is useful for troubleshooting 'Unable to execute file' errors. ```bash ldd --version ``` -------------------------------- ### Windows Architecture Detection Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md This XML snippet shows how to detect the x64 architecture on Windows using System.Runtime.InteropServices.RuntimeInformation to set the Tailwind release name. ```xml tailwindcss-windows-x64.exe ``` -------------------------------- ### Detect Windows Architecture (PowerShell) Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/PLATFORM_SUPPORT.md Use this PowerShell command to determine the OS architecture on Windows. It outputs 'X64' for 64-bit Intel/AMD or 'Arm64' for ARM64 architectures. ```powershell # PowerShell [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture # Output: X64 or Arm64 ``` -------------------------------- ### Register Input Files for dotnet watch Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md This ItemGroup registers the input stylesheet for monitoring when using 'dotnet watch'. The condition ensures the input file exists before registration, preventing issues if the file is missing at load time. ```xml ``` -------------------------------- ### Configure Tailwind CSS to Use Latest Version with Caching Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md Set Tailwind CSS to always use the latest release by setting the version to 'latest'. Be aware that each build will contact GitHub to check for new releases, which may slow down builds. ```xml latest Styles/input.css wwwroot/css/output.css ``` -------------------------------- ### Linux and macOS Default Download Path Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/configuration.md The default location where Tailwind binaries are cached on Linux and macOS systems, using XDG_CACHE_HOME or falling back to ~/.cache. ```text $XDG_CACHE_HOME/Tailwind/{version}/ ``` ```text $HOME/.cache/Tailwind/{version}/ ``` -------------------------------- ### Enable Tailwind CSS Output Optimization Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-properties.md Pass the `--optimize` flag to the Tailwind CLI to optimize the generated stylesheet. This is useful for production builds. ```xml true ``` -------------------------------- ### Configure Tailwind CSS for Production Build Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/README.md Optimize and minify the output CSS stylesheet for production builds by setting the corresponding Tailwind properties. ```xml true true ``` -------------------------------- ### Tailwind Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/DOCUMENTATION_MANIFEST.txt Executes the Tailwind CSS CLI to process the input stylesheet and generate the output stylesheet. ```APIDOC ## Tailwind ### Description Invokes the Tailwind CSS CLI to compile the input stylesheet (`TailwindInputStyleSheetPath`) into the output stylesheet (`TailwindOutputStyleSheetPath`), applying specified optimizations and minification. ### Method MSBuild Target ### Endpoint N/A (MSBuild Target) ### Parameters #### Required MSBuild Properties - **TailwindInputStyleSheetPath** (string) - Required - The path to the input Tailwind CSS stylesheet. - **TailwindOutputStyleSheetPath** (string) - Required - The path where the compiled Tailwind CSS stylesheet will be saved. #### Optional MSBuild Properties - **TailwindVersion** (string) - Required - The version of Tailwind CSS to use (influences which binary is executed). - **TailwindOptimizeOutputStyleSheet** (boolean) - Optional - Whether to optimize the output stylesheet. Defaults to false. - **TailwindMinifyOutputStyleSheet** (boolean) - Optional - Whether to minify the output stylesheet. Defaults to false. - **TailwindGenerateSourceMap** (boolean) - Optional - Whether to generate source maps. Defaults to false. - **TailwindOutputSourceMapPath** (string) - Optional - The path for the generated source map file, only used if `TailwindGenerateSourceMap` is true. ### Request Example ```xml ./src/styles.css ./wwwroot/css/styles.min.css true true ./wwwroot/css/styles.min.css.map ``` ### Response #### Success Response MSBuild target execution completes. The output CSS file and optionally a source map are generated at the specified paths. #### Response Example N/A (MSBuild Target) ``` -------------------------------- ### Watch Tailwind Build Targets Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/USAGE_GUIDE.md In a separate terminal, use this command to monitor the Tailwind build process. It rebuilds CSS whenever the input stylesheet changes. ```bash dotnet watch msbuild /t:Tailwind ``` -------------------------------- ### Set Tailwind CLI Version Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-properties.md Specify the Tailwind Standalone CLI version to download. Use a specific tag like 'v4.0.14' or 'latest' to always fetch the newest release. Using 'latest' checks GitHub on every build. ```xml v4.0.14 ``` -------------------------------- ### Conditional MSBuild Target Execution Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/BUILD_SYSTEM.md This snippet demonstrates how to conditionally execute an MSBuild target based on the operating system. It uses the `IsLinux()` method to ensure the target runs only on Linux environments. ```xml ``` -------------------------------- ### MSBuild Targets Reference Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/DOCUMENTATION_MANIFEST.txt This section details all available MSBuild targets for Tailwind.Standalone, including their purpose and execution order. ```APIDOC ## MSBuild Targets ### Description Reference for all MSBuild targets provided by Tailwind.Standalone. ### Method N/A (Targets are invoked during the MSBuild build process) ### Endpoint N/A (Targets are invoked within MSBuild project files) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response (200) N/A (Targets are executed during the build process) ### Response Example N/A ``` -------------------------------- ### Configure Tailwind.Standalone in .csproj Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/README.md Specify Tailwind CSS version and stylesheet paths in your .csproj file for integration with MSBuild targets. ```csproj latest Styles/main.css wwwroot/main.css ``` -------------------------------- ### Customize Tailwind CSS Cache Location Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/README.md Specify a custom directory for downloading and caching the Tailwind CSS CLI binary. ```xml /var/cache/tailwind ``` -------------------------------- ### Configure Tailwind.Standalone in .csproj Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/configuration.md Add Tailwind configuration properties within a PropertyGroup element in your .csproj file. This is the primary method for configuring the tool. ```xml v4.0.14 Styles/main.css wwwroot/main.css ``` -------------------------------- ### Manual MSBuild Tailwind Target Invocation Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-targets.md Demonstrates how to manually invoke the Tailwind MSBuild target from the command line. This is useful for running the compilation process outside of the standard build. ```bash # Run Tailwind compilation standalone (useful during development) dotnet msbuild /t:Tailwind # Use with dotnet watch for hot reload during development dotnet watch msbuild /t:Tailwind ``` -------------------------------- ### Conditional Configuration for Debug vs Release Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/configuration.md Applies different Tailwind.Standalone settings based on the build configuration (Debug or Release), enabling conditional source map generation or optimization. ```xml v4.0.14 Styles/input.css wwwroot/css/output.css true wwwroot/css/output.css.map true ``` -------------------------------- ### Set Tailwind Download Cache Path Source: https://github.com/marshalhayes/tailwind.standalone/blob/main/_autodocs/api-reference/msbuild-properties.md Specify a custom directory for caching Tailwind CLI binaries. This path must be writable by the current user and accessible in CI/CD environments. ```xml C:\\Tools\\TailwindCache ```