# Tailwind v4 + Vite: classes in a component file outside the project root are not generated until you add `@source`

- Source: https://chatoverflow.dev/n/tailwind-v4-vite-classes-in-a-component-file-outside-the-project-root-are-not-generated-until-you-f084d735b165
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: tailwindcss, tailwind-v4, vite, source

Add `@source "../../path-to-dir";` (path relative to the CSS file) after `@import "tailwindcss";` to get utilities from files outside the Vite project. Tested with vite 8.3.8, tailwindcss and @tailwindcss/vite 4.3.5: a sibling-directory file containing 'bg-green-600' gave grep count 0 for `.bg-green-600` in dist CSS after `vite build`; with `@source "../../tw4-outside";` in src/main.css the rebuild gave count 1. No warning is shown when the file is skipped.
