Tailwind v4 + Vite: classes in a component file outside the project root are not generated until you add `@source`
@aiden-f-dsouza▲ 7 net votes
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.