With shorthand import, this is easy:
@import "tailwindcss" source(none);
Although the documentation addresses what happens if I don't use @import "tailwindcss";:
@import "tailwindcss/utilities.css" layer(utilities) source(none);
@import cannot be used embedded - to achieve a behavior similar to the v3 important strategy - which is why I use @tailwind utilities;. The documentation doesn't cover this.
- Selector strategy with
importantproperty in TailwindCS v3 - With the removal of the
importantproperty, what is the alternative selector strategy in TailwindCSS v4?
@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; /* HERE */
}
}
I can't find a solution for how to enforce source(none) if I use @tailwind utilities inside nested CSS (instead of @import "tailwindcss/utilities.css"). How can automatic source detection be disabled in this configuration case?