TL;DR: Use @config directive.

From v4 onwards, the use of the tailwind.config.js file has been removed, and CSS-first directives are provided for configuration. The init process, which previously generated this config file by default, has also been discontinued. If you want to use a JS-based config file from v4 onwards, you must create it manually and specify its location in CSS using the @config directive so that v4 can find the configuration.

  • Changed npx tailwindcss to npx @tailwindcss/cli - TailwindCSS v4 Docs
  • Removed npx tailwindcss init process - StackOverflow
  • Deprecated: Sass, Less and Stylus preprocessors support - StackOverflow
  • CSS-first configuration instead of tailwind.config.js - TailwindCSS v4 Docs
  • Use @config directive to legacy JavaScript-config - StackOverflow
  • Automatic Source Detection - StackOverflow

TailwindCSS v4 is backwards compatible with v3

I see that you've created the old v3 legacy JavaScript-based configuration. In v4, this is no longer necessary due to the new CSS-first configuration, but you can still use it by adding an extra @config directive if needed.

Using a JavaScript config file

JavaScript config files are still supported for backward compatibility, but they are no longer detected automatically in v4.

If you still need to use a JavaScript config file, you can load it explicitly using the @config directive:

@config "../../tailwind.config.js";
  • Using a JavaScript config file - TailwindCSS v4 Update Guide

The configuration setting has changed by default. However, you have the option to declare the location of your tailwind.config.js file using a relative path in your default CSS file so you can use it again.

New configuration option in v4

CSS-First Configuration: Customize and extend the framework directly in CSS instead of JavaScript.

With TailwindCSS v4, you have the option to omit the tailwind.config.js file. You can find many new directives, such as @theme, which allows you to declare your custom settings directly in your CSS file, or @plugin, which lets you import TailwindCSS v4-compatible plugins directly in your CSS file.

I won't list all the new directives, but you can check them out here:

  • Functions and directives - TailwindCSS v4 Docs
Answer from rozsazoltan on Stack Overflow
🌐
Tailwind CSS
tailwindcss.com › blog › tailwindcss-v4
Tailwind CSS v4.0 - Tailwind CSS
With the improvements we've made to this process for v4.0, Tailwind feels more light-weight than ever: Just one-line of CSS — no more @tailwind directives, just add @import "tailwindcss" and start building.
🌐
Reddit
reddit.com › r/tailwindcss › (solution) tailwind v4 missing tailwind.config.js
r/tailwindcss on Reddit: (Solution) Tailwind V4 Missing tailwind.config.js
January 25, 2025 -

So I was starting a new vite-react tailwind project and tailwind has been updated to v4 just recently. Was gonna create some new themes config but no `tailwind.config.js` files were being generated.

After some research and experimentation, finally made it work!

Update from Tailwind Docs:

Instead of a tailwind.config.js file, you can configure all of your customizations directly in the CSS file where you import Tailwind, giving you one less file to worry about in your project:

Also, if you aren't sure how to initialize the project or make a new tailwind css project, you can follow this guide: https://drive.google.com/file/d/1mlmO0e479nASrxJ-YLImHoxpmwCymLHs/view , credits to: https://www.youtube.com/watch?v=-JDCFN0Znj8

Hope this helps ya'll! I couldn't post it on StackOverflow cuz I only recently made a new account.

Mar 17, 2025 Edit: this guy has a more in-depth explanation and fix to this new update. Including the content, plugins, etc:

New CSS-First configuration

🌐
Tailwind CSS
tailwindcss.com › docs › upgrade-guide
Upgrade guide - Getting started - Tailwind CSS
In v4, these values are preserved which is more consistent with how other utilities in Tailwind work. This means you may need to explicitly use via-none if you want to "unset" a three-stop gradient back to a two-stop gradient in a specific state: ... <div class="bg-linear-to-r from-red-500 via-orange-400 to-yellow-400 dark:via-none dark:from-blue-500 dark:to-teal-400"> <!-- ... --></div> In v3, the container utility had several configuration options like center and padding that no longer exist in v4.
🌐
Bryan Anthonio
bryananthonio.com › blog › configuring-tailwind-css-v4
A First Look at Setting Up Tailwind CSS v4.0
In this post, I’ll share my experience migrating to TailwindCSS v4, focusing on the new @theme directive and how it simplifies design token management. You’ll see how the new approach eliminates the need for a separate JavaScript configuration file and makes working with CSS variables more ...
Top answer
1 of 1
11

TL;DR: Use @config directive.

From v4 onwards, the use of the tailwind.config.js file has been removed, and CSS-first directives are provided for configuration. The init process, which previously generated this config file by default, has also been discontinued. If you want to use a JS-based config file from v4 onwards, you must create it manually and specify its location in CSS using the @config directive so that v4 can find the configuration.

  • Changed npx tailwindcss to npx @tailwindcss/cli - TailwindCSS v4 Docs
  • Removed npx tailwindcss init process - StackOverflow
  • Deprecated: Sass, Less and Stylus preprocessors support - StackOverflow
  • CSS-first configuration instead of tailwind.config.js - TailwindCSS v4 Docs
  • Use @config directive to legacy JavaScript-config - StackOverflow
  • Automatic Source Detection - StackOverflow

TailwindCSS v4 is backwards compatible with v3

I see that you've created the old v3 legacy JavaScript-based configuration. In v4, this is no longer necessary due to the new CSS-first configuration, but you can still use it by adding an extra @config directive if needed.

Using a JavaScript config file

JavaScript config files are still supported for backward compatibility, but they are no longer detected automatically in v4.

If you still need to use a JavaScript config file, you can load it explicitly using the @config directive:

@config "../../tailwind.config.js";
  • Using a JavaScript config file - TailwindCSS v4 Update Guide

The configuration setting has changed by default. However, you have the option to declare the location of your tailwind.config.js file using a relative path in your default CSS file so you can use it again.

New configuration option in v4

CSS-First Configuration: Customize and extend the framework directly in CSS instead of JavaScript.

With TailwindCSS v4, you have the option to omit the tailwind.config.js file. You can find many new directives, such as @theme, which allows you to declare your custom settings directly in your CSS file, or @plugin, which lets you import TailwindCSS v4-compatible plugins directly in your CSS file.

I won't list all the new directives, but you can check them out here:

  • Functions and directives - TailwindCSS v4 Docs
🌐
Medium
medium.com › @kidaneberihuntse › tailwind-css-v4-1-has-no-tailwind-config-js-heres-how-to-customize-everything-with-theme-11a19b108963
🚀 Tailwind CSS v4.1 Has No tailwind.config.js — Here’s How to Customize Everything With @theme | by Kidu BT | Medium
May 30, 2025 - Tailwind CSS v4.1 is a major leap forward in simplicity and clarity. It treats your design tokens as CSS variables, and you manage them directly in CSS — not JavaScript. This means: No more switching between tailwind.config.js and your styles.
Find elsewhere
🌐
Alex Vipond
alexvipond.dev › blog › configuring-tailwind-4-0
Configuring Tailwind 4.0 - Alex Vipond
I'm into web development and social impact. I write code and create content for these topics, and I share it on my website.
🌐
daisyUI
daisyui.com › docs › install
Install daisyUI as a Tailwind plugin — daisyUI Tailwind CSS Component UI Library
See example setup of daisyUI and Tailwind CSS on different frameworks and build tools.
🌐
GitHub
github.com › tailwindlabs › tailwindcss
GitHub - tailwindlabs/tailwindcss: A utility-first CSS framework for rapid UI development. · GitHub
For full documentation, visit tailwindcss.com.
Starred by 94.5K users
Forked by 5.2K users
Languages   TypeScript 81.7% | Rust 15.7%
🌐
Nativewind
nativewind.dev › docs › getting-started › installation
Installation
February 22, 2026 - Add the paths to all of your component files in your tailwind.config.js file.
🌐
GEEKLY
geekly.blog › tailwind-css-v4-0
Tailwind CSS v4.0 est sortie, quels sont les changements majeurs ?
January 23, 2025 - @import "tailwindcss"; @theme { ... l’utilisation de plugins ou certaines configurations, il vous faudra utiliser @plugin, @variant, @config ou bien @import selon vos besoins....
🌐
Dande
dande.dev › blog › getting-started-with-tailwind-v4
Getting Started with Tailwind v4 | Dande.dev
Tailwind v4 will automatically generate the corresponding CSS: ... In Tailwind v3, there is a popular plugin called tailwindcss-animate that provides a set of animation classes for Tailwind CSS.
Top answer
1 of 1
31

New "CSS-first" configuration from v4 (instead of tailwind.config.js)

CSS-First Configuration: Customize and extend the framework directly in CSS instead of JavaScript.

  • Which TailwindCSS v4 namespace matches a given TailwindCSS v3's theme keys?

With TailwindCSS v4, you have the option to omit the tailwind.config.js file. You can find many new directives, such as @theme, which allows you to declare your custom settings directly in your CSS file, or @plugin, which lets you import TailwindCSS v4-compatible plugins directly in your CSS file.

I won't list all the new directives, but you can check them out here:

  • Functions and directives - TailwindCSS v4 Docs

Customizing your theme

If you want to change things like your color palette, spacing scale, typography scale, or breakpoints, add your customizations using the @theme directive in your CSS:

@theme {
  --font-display: "Satoshi", "sans-serif";
  --breakpoint-3xl: 1920px;
  --color-avocado-100: oklch(0.99 0 0);
  --color-avocado-200: oklch(0.98 0.04 113.22);
  --color-avocado-300: oklch(0.94 0.11 115.03);
  --color-avocado-400: oklch(0.92 0.19 114.08);
  --color-avocado-500: oklch(0.84 0.18 117.33);
  --color-avocado-600: oklch(0.53 0.12 118.34);
  --ease-fluid: cubic-bezier(0.3, 0, 0, 1);
  --ease-snappy: cubic-bezier(0.2, 0, 0, 1);
  /* ... */
}

Learn more about customizing your theme in the theme variables documentation.

  • Which TailwindCSS v4 namespace matches a given TailwindCSS v3's theme keys?
  • Adding Custom Styles: Customizing your theme - TailwindCSS v4 Docs

@plugin

Use the @plugin directive to load a legacy JavaScript-based plugin:

@plugin "@tailwindcss/typography";

The @plugin directive accepts either a package name or a local path.

  • @plugin directive - TailwindCSS v4 Docs

Related questions/answers for new CSS-first theme handling:

  • How to use custom color themes in TailwindCSS v4
  • How to override theme variables in TailwindCSS v4 - @theme vs @layer theme vs :root
  • When should I use * and when should I use :root, :host as the parent selector?
  • Should I use @theme or @theme inline?
  • How to switch to a CSS-first configuration in Tailwind CSS v4 and above

TailwindCSS v4 is backwards compatible with v3

Using a JavaScript config file

JavaScript config files are still supported for backward compatibility, but they are no longer detected automatically in v4.

If you still need to use a JavaScript config file, you can load it explicitly using the @config directive:

@config "../../tailwind.config.js";
  • Using a JavaScript config file - TailwindCSS v4 Update Guide

The configuration setting has changed by default. However, you have the option to declare the location of your tailwind.config.js file using a relative path in your default CSS file so you can use it again.

🌐
Next.js
nextjs.org › docs › app › getting-started › css
Getting Started: CSS | Next.js
2 days ago - Import global styles and Tailwind stylesheets in the root of your application.
🌐
Medium
medium.com › @aqib-2 › tailwind-css-4-1-say-goodbye-to-config-files-hello-to-css-first-configuration-a068b3a25c76
Tailwind CSS 4.1: Say Goodbye to Config Files, Hello to CSS-First Configuration | by Mohammed Aqib | Medium
June 11, 2025 - Gone are the days of wrestling with JavaScript config files — welcome to the era of CSS-first customization. If you’ve been using Tailwind CSS for a while, you’re probably familiar with the traditional tailwind.config.js file where you'd define your custom colors, spacing, breakpoints, and other design tokens.
🌐
Tailwind CSS
tailwindcss.com › docs
Installing Tailwind CSS with Vite - Tailwind CSS
Add the @tailwindcss/vite plugin to your Vite configuration.
🌐
Scribd
scribd.com › document › 887634067 › Tailwind-v4-Configuration-Examples
Tailwind CSS v4 Configuration Guide | PDF | Software Development | Software Engineering
This document provides examples for configuring Tailwind CSS v4 using a new CSS-based approach, illustrating the migration from v3's JavaScript configuration. It covers various aspects such as colors, typography, spacing, and advanced configurations like custom gradients and animations.