@layer utilities is used but no matching @tailwind utilities directive is present. #5934
-
I am trying to use the @layer and @Variants in a style sheet that gets imported into my main style.css file style.css
typography.css (not showing all the css here)
Having the @layer and @Variants in the imported style sheet results in this error message
If I move the @layer and @Variants code to the main style.css then everything works fine. I would prefer to keep the @layer @Variants in the corresponding css file where they belong if possible as I have the need to use this same structure for other special elements/circumstances. Environment:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
Hey! This will work as long as you include https://tailwindcss.com/docs/using-with-preprocessors#build-time-imports |
Beta Was this translation helpful? Give feedback.
-
@adamwathan perfect! Thank you so much for the speedy response. |
Beta Was this translation helpful? Give feedback.
-
Hello, I have tried following the instructions from the website closely but I am still getting the exact same error. When I tried using
module.exports = {
plugins: {
"postcss-import": {},
tailwindcss: {},
autoprefixer: {},
},
};
@import "./table.css";
@tailwind base;
@tailwind components;
@tailwind utilities;
... // other pure css
@layer utilities {
.row-shadow {
box-shadow: 0px 0px 16px 4px rgba(0, 0, 0, 0.08);
}
.row-border {
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 1);
}
} Here are my dependencies, I am using React 18.1.0: "autoprefixer": "^10.4.7",
"postcss": "^8.4.14",
"postcss-import": "^14.1.0",
"tailwindcss": "^3.0.24" |
Beta Was this translation helpful? Give feedback.
-
Hello, I got the same issue only for Angular (starting from version 15). There is an issue created in Git Hub, however, it was marked as won't fix. They stated that Angular acts as expected for CSS (postcss is being executed on each file individually instead of the concatenated stylesheet) since it aligns more consistently with standard browser behavior angular/angular-cli#27005 My question would be, do you think it is something I should push for to make Tailwind work out of the box without the use of a custom webpack configuration for that? |
Beta Was this translation helpful? Give feedback.
Hey! This will work as long as you include
postcss-import
in your plugin list to ensure that the CSS file is properly imported at build-time. Make sure it's the first plugin:https://tailwindcss.com/docs/using-with-preprocessors#build-time-imports