I'd like to use tailwindcss for my styles in a nx monorepo.
I made a global style lib with a global-styles.scss file to keep the global styles that should be added to every app.
@tailwind base;
@tailwind components;
@tailwind utilities;
.test {
color: aqua;
}
#root {
--teal: #008285;
--iceberg: #D1F0F1;
--polar: #F6FCFD;
--scooter: #2BBEC3;
--purple: #481059;
--white: #FFFFFF;
--red: #E8203A;
--black: #2C2C2C;
}
in my workspace.json I've added the path to this style file to the build target.
"styles": ["apps/my-app/src/styles.scss", "libs/ui-shared/src/lib/styles/global-styles.scss"],
Now, both the test class as the css variables are picked up by my application, but none of the tailwind classes work, so the @tailwind directive doesn't work.
The tailwind.config.js and postcss.config.js live in the apps/my-app folder, and when I move the global-styles.scss file from the libs directory to this application folder, everything does work. So I wonder if there is some kind of configuration or rule that you have to keep the css files in the same (or deeper nested) location as the postcss.config file?
And I wonder if I can get the tailwind imports to work in that global styles file? Thanks for the advice or explanation!