Disable automatic source detection when use @tailwind utilities
#19367
-
|
Although the documentation addresses what happens if I don't use
@layer theme, base, components, utilities;
@import "tailwindcss/theme.css" layer(theme);
/* For disable Preflight just don't import preflight.css */
/* See more: https://tailwindcss.com/docs/preflight#disabling-preflight */
/* @import "tailwindcss/preflight.css" layer(base); */
@custom-variant dark (&:where(.dark, .dark *));
@source "./../../../resources/views/livewire/pulse/top-sellers.blade.php";
@theme {
/* ... */
}
@layer utilities {
#top-sellers {
@tailwind utilities source(none); /* HERE */
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hey! From what I understand about Tailwind v4, So something like: might be closer to the intended pattern, especially if you're already disabling Preflight (by not importing it). I haven’t seen official guidance that says "this is the one correct way," but the general idea seems to be:
If Tailwind publishes a clearer recommendation, it might confirm whether this approach is the best fit - but it looks consistent with how v4 handles sources so far. |
Beta Was this translation helpful? Give feedback.
-
|
I managed to get to testing; I thought someone would have the solution off the cuff. So, @layer theme, base, components, utilities;
@import "tailwindcss/theme.css" layer(theme);
/* For disable Preflight just don't import preflight.css */
/* See more: https://tailwindcss.com/docs/preflight#disabling-preflight */
/* @import "tailwindcss/preflight.css" layer(base); */
@custom-variant dark (&:where(.dark, .dark *));
@source "./../../../resources/views/livewire/pulse/top-sellers.blade.php";
@theme {
/* ... */
}
@layer utilities {
#top-sellers {
@tailwind utilities source(none); /* HERE */
}
}Additionally, I found that this syntax isn't necessary - @layer theme, base, components, utilities;
@import "tailwindcss/theme.css" layer(theme);
/* For disable Preflight just don't import preflight.css */
/* See more: https://tailwindcss.com/docs/preflight#disabling-preflight */
/* @import "tailwindcss/preflight.css" layer(base); */
@custom-variant dark (&:where(.dark, .dark *));
@source "./../../../resources/views/livewire/pulse/top-sellers.blade.php";
@theme {
/* ... */
}
#top-sellers {
@import "tailwindcss/utilities.css" layer(utilities) source(none);
}References:
|
Beta Was this translation helpful? Give feedback.
I managed to get to testing; I thought someone would have the solution off the cuff.
So,
source(none)works perfectly, just as I expected.Additionally, I found that this syntax…