-
Hello, thank you for releasing v4 beta, I really like the idea of working in css as it makes a lot of things more simpler for reusability than js plugins. Hope you can answer some questions I have related to importing and nesting css Importing and nesting wasn't a problem in v3 when using
In v4, I replaced the above with just the I have a component library with fragmented stylesheets for reusable component styles, which I import into a single components.css file. I then import this and other style collections into a main.css tailwind stylesheet, using the layer function so they can be injected into the correct tailwind layer. Again, not a problem in v3 but for v4 it doesn't work as expected. So, I have a few questions about import and nesting in v4:
Hoping to get some guidance on this if someone already solved a similar issue with v4 or if the feature is still in development. I don't have a problem with v4 when using a single stylesheet inside an app but when I have multiple packages with different styles and I want to merge them together with layer imports, things don't exactly work out. The themes aren't injected and the nested styles aren't processed into css. Thanks for your work on this! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Yes, this should be possible: /* a.css */
@theme {
--color-foo: red;
} /* b.css */
@theme {
--color-bar: blue;
} /* input.css */
@import "tailwindcss";
@import "./a.css";
@import "./b.css"; Would compile to something like: @layer theme, base, components, utilities;
@layer theme {
:root {
…
--color-foo: red;
--color-bar: blue;
}
}
Nesting works in the sense that Tailwind now uses native CSS nesting.
Tailwind should be able to build from an external stylesheet,
You shouldn't need to, if the stylesheet itself has |
Beta Was this translation helpful? Give feedback.
Yes, this should be possible:
Would compile to something like: