Getting Started (Tailwind v4+)

April 14, 2026 ยท View on GitHub

This guide is for projects using Tailwind v4 and above. For Tailwind v3 projects, use the v3 Getting Started guide.

Video

For a quick walkthrough, watch the Getting Started video guide.

Existing Projects

  1. The extension automatically detects CSS files that contain @import "tailwindcss".
    If needed, right-click the file and select Set as Tailwind CSS configuration file.
    Features are enabled only after a configuration file is detected or set manually.

    Customizability Build 1

New Projects

  1. Right-click the project in Solution Explorer and select Set up Tailwind CSS:

    • Installs tailwindcss and @tailwindcss/cli if needed
    • Creates tailwind.css with @import "tailwindcss"

    Set up TailwindCSS

  2. If you use the standalone Tailwind CSS CLI:

    • Set the path in Tools > Options > Tailwind CSS IntelliSense > Tailwind CLI path
    • Then use Set up Tailwind CSS (use CLI)
    • Toggle CLI usage with UseCli in tailwind.extension.json
  3. For theme setup, follow the official guide.

    For simple files with no theme values:

    @import "tailwindcss";
    

    If your project root is different from the folder containing your input CSS file:

    @import "tailwindcss" source("../path/to/source");
    

Setting Up the Extension

  1. The default output is {input}.output.css, which can be changed in the global extension settings.

    To change it, right-click the file and select Link as Tailwind CSS output file.

    Input and output CSS files

  2. IntelliSense works in .html, .css, .cshtml, .razor, and similar files. Configuration contexts follow Tailwind's file detection.

    IntelliSense

  3. Tailwind builds automatically when the project builds, or manually via Build > Build Tailwind CSS.

    Build process

Extension Configuration

Settings for this extension can be updated in Tools > Options > Tailwind CSS IntelliSense.

SettingCategoryDescriptionDefault Value
Enable extensionGeneralEnables/disables the extension globallytrue
Automatically apply library updatesGeneraltailwindcss and @tailwindcss/cli update on project open. The extension works best with the most recent update of each major version, so this setting is recommended.true
Show color previewsGeneralColor previews for color classestrue
Minify buildsBuildUse of --minify when buildingfalse
Default output file nameBuildOutput file name template used when not specifically specified. Use {0} to reference the original input file name.{0}.output.css
Build typeBuild
  • Default: Tailwind --watch, on project build
  • Manual: once, Ctrl+1, Ctrl+2/3
  • OnBuild: once, on project build
  • OnSave: once, on file save
  • ManualJIT: Tailwind --watch, Ctrl+1, Ctrl+1/2/3
  • None
Default
OnSave trigger: file extensionsBuildFile extensions that trigger the OnSave build event. Only takes effect when "Build type" is set to OnSave..css;.html;.cshtml;.razor;.js
Tailwind CLI pathBuildThe path to the standalone Tailwind CLI. If UseCli is set to true in a project, building uses this file instead of npx.
Verbose buildBuildShows full build logfalse
Build scriptCustom BuildThe name of the script to execute on build (defined in package.json), optional
Override buildCustom BuildRun the script defined in "Build script" exclusively or together with the default build processfalse
Tailwind CSS completions before allCompletionsTailwind completions show up before or after default completionstrue
Class sort typeClass Sort
  • OnSave: sort open file on save
  • OnBuild: sort updated files in the entire solution on build
  • Manual: sort through Tools > Sort Tailwind classes
  • None
OnSave

Linter options

SettingCategoryDescriptionDefault Value
Enable linterLinterEnables/disables the lintertrue
Invalid screenLinterUnknown screen name used with the @screen directive.Error
Invalid Tailwind directiveLinterUnknown value used with the @tailwind directive.Error
Invalid config pathLinterUnknown or invalid path used with the theme helper.Error
CSS conflictLinterClass names on the same HTML element / CSS class which apply the same CSS property or properties.Warning

tailwind.extension.json Customization

  • BuildFiles: List of relative input file paths to build with the project.
    • Input: Input CSS file (one output per input).
    • Output: Output CSS file.
    • Behavior: How the input file should be built; Default uses global extension settings (valid values: Default, Minified, Unminified)
  • PackageConfigurationFile: Relative path to package.json, used to determine custom build scripts defined in extension settings.
  • UseCli: If true, uses the Tailwind CLI (if installed and configured) instead of npx @tailwindcss/cli.
  • CustomRegexes: Custom regexes for completions, sorting, linting, etc., with separate options for Razor, HTML, and JS.
    • Override: If true, ignores default regexes.
    • Values: Priority-ordered list of regexes per context.
    • Notes:
      • Must use valid C# regex syntax.
      • Regex must include a content capture group (e.g., class="(?<content>.*)").
      • Custom regexes may override defaults.
      • Test thoroughly to avoid unintended behavior from overly general or overlapping patterns.

Sample file

{
  "$schema": "https://raw.githubusercontent.com/theron-wang/Tailwind-CSS-for-Visual-Studio/refs/heads/main/tailwind.extension.schema.json",
  "BuildFiles": [
    {
      "Input": "..\\Client\\tailwind.css",
      "Output": "..\\Client\\tailwind.output.css",
      "Behavior": "Default"
    },
    {
      "Input": "tailwind.css",
      "Output": "tailwind.min.css",
      "Behavior": "Minified"
    }
  ],
  "PackageConfigurationFile": "package.json",
  "UseCli": false,
  "CustomRegexes": {
    "Razor": {
      "Override": false,
      "Values": [
        "your regex"
      ]
    },
    "HTML": {
      "Override": false,
      "Values": []
    },
    "JavaScript": {
      "Override": true,
      "Values": [
        "your regex"
      ]
    }
  }
}