[v4] How to ignore specific files using "@source not" and glob pattern? #18550
Replies: 2 comments
-
|
@mek-earnin |
Beta Was this translation helpful? Give feedback.
-
|
There are tests in Tailwind's scanner for patterns like these: @source not 'src/index.ts';
@source not '**/*.{jsx,tsx}';
@source not './src/**/ignore.html';So if the negation is not taking effect, I would look at the pattern/base path rather than the feature itself. For your case I would keep the negated patterns scoped to the exact source root you added, and avoid the broad @import "tailwindcss" source(none);
@source "./index.html";
@source "./src/**/*.{ts,tsx}";
@source "../../packages/design-system/src/**/*.{ts,tsx}";
@source not "../../packages/design-system/src/**/*.stories.tsx";
@source not "../../packages/design-system/src/**/*.stories.ts";
@source not "../../packages/design-system/src/**/*.spec.tsx";
@source not "../../packages/design-system/src/**/*.spec.ts";Two small gotchas:
I would not use the old |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What I want to do
Configuring a vite app to detect class names in the design system package and exclude custom styles in storybook files and unit test files.
Context
Component.tsx,Component.stories.tsx, andComponent.spec.tsxtailwindcss@4.1.11,@tailwindcss/vite@4.1.11,vite@6.2.2What I have tried
I added an arbitrary class i.e.,
w-[7777px], in certain files and tried building it withthen inspected whether the class is included in
output.css.1. file glob with
@source not(not working)2.
@configwithcontent(not working)Potential issues
@sourceor the new Scanner doesn't actually support file level glob but only supports directory level glob?@source "../../lib/ui/**/*.bin";, although unclear whether it works with@source notor not.Beta Was this translation helpful? Give feedback.
All reactions