-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[v4] Ignore certain paths from scanning no longer supported #15943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Just inquiring if this is on the roadmap to get fixed/implemented or if this is by design for v4? |
We have some css modules and tax files which are only supposed to be used with Storybook, and after upgrading to TW4, all those css modules have been "sucked" into our styles.css, the content setting in tailwind.config indeed seems to be ignored completely, would be very useful with a @ignore-path or similar. |
I also have similar needs, I want to exclude any test and story files. content: [
'!./src/stories/**/*.{js,jsx,ts,tsx,mdx}',
'!./src/testing/**/*.{js,jsx,ts,tsx,mdx}',
'!./src/**/*.{spec,test,unit,accept,integrate,system,stories}.*',
'!./src/**/*.stories.{js,jsx,ts,tsx,mdx}',
'./src/**/*.{js,jsx,ts,tsx}'
], |
I'm facing the same problem and seems the issue is not directly related to the @tailwindcss-vite but tailwindcss itself.
I strongly believe (but ofc I can be mistaken) the issue is in the snippet above, there is no filter, all files in content array are being included. Also didnt find any tests in Seems the package @tailwindcss-vite checks for character This directs my fellings towards the It was what my 5 minutes research gaves me, just sharing what I saw in order to make the work of somebody faster. ty in advance! |
Tailwind V4 版本的扫描文件不再使用配置文件设置, 官方文档提供了以下方法设置: Tailwind 将扫描项目中的每个文件以查找类名,但以下情况除外: 解决方案:
|
I addition to the above, perhaps some might find this useful for excluding parts of a directory?
|
In addition, slightly related to this, the This was super annoying, not documented anywhere and cost me two whole days to debug. Oh. My. God. How to ignore a file from git but still allow it to be rendered by Tailwind v4?! These are two completely separate concerns. |
What version of Tailwind CSS are you using?
v4.0.0
What build tool (or framework if it abstracts the build tool) are you using?
Vite 6
What version of Node.js are you using?
22.13
Describe your issue
In v3 one could add a line with an exclamation mark
!
prefix in thetailwind.config.js
to exclude certain files or paths from being scanned:but that option seems to have vanished in v4. I know I can do
@import 'tailwindcss' source(none);
and then@source '../../../resources/views';
which works but there is no way to exclude a subfolder from that path.One work around is to add all the subfolders by hand, but that's a bit of a PITA when the project grows and you forget you need to add every view subfolder to the config css now.
The text was updated successfully, but these errors were encountered: