Prefix does not work with custom layer #19267
-
|
What version of Tailwind CSS are you using? 4.1.16 What build tool (or framework if it abstracts the build tool) are you using? @tailwindcss/vite - What version of Node.js are you using? v22.21.0 What browser are you using? N/A What operating system are you using? N/A Reproduction URL Describe your issue Simply adding a custom CSS layer to a tailwind import with prefix makes the prefix not work. I need a custom CSS tailwind build, without the prefix. Therefore, I use only the theme and utilities from tailwind, without the prefix. So my tailwind imports look like this @import "tailwindcss/theme.css" prefix(twa);
@import "tailwindcss/utilities.css" prefix(twa);As soon as I add the layer directive to the import, it fails: @import "tailwindcss/theme.css" prefix(twa) layer(custom);
@import "tailwindcss/utilities.css" prefix(twa) layer(custom);In fact, it proves that even with a default tailwind, the prefix and layer combination doesn't work @import "tailwindcss" prefix(twa) layer(custom); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
As per the documentation, the --- a/src/style.css
+++ b/src/style.css
@@ -1,4 +1,4 @@
-@import "tailwindcss/theme.css" prefix(twa) source(none) layer(custom);
-@import "tailwindcss/utilities.css" prefix(twa) source(none) layer(custom);
+@import "tailwindcss/theme.css" layer(custom) prefix(twa) source(none);
+@import "tailwindcss/utilities.css" layer(custom) prefix(twa) source(none);
@source './';You'd also need a +@layer foo, bar, custom, baz;
+
@import "tailwindcss/theme.css" layer(custom) prefix(twa) source(none);
@import "tailwindcss/utilities.css" layer(custom) prefix(twa) source(none); |
Beta Was this translation helpful? Give feedback.

As per the documentation, the
prefix()should come afterlayer():You'd also need a
@layerrule before as well, like: