-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for configuring PostCSS for Angular projects #9650
Comments
Have you tried the following? const { join } = require('path');
module.exports = {
plugins: {
tailwindcss: {
config: join(__dirname, 'tailwind.config.js'),
},
autoprefixer: {},
},
}; |
Yes, i tried, but it looks like |
Thanks for reporting this! This limitation comes from I'm changing the label and title of the issue to track the request correctly. |
@leosvelperez hi! my problem occurs with applications in serve and build mode too. as far as I know the application builder does not use ng-packagr. |
@zvnt I'm sorry, somehow I missed you were referring to apps as well 🤦🏻 Still, there's no built-in/automatic support for PostCSS configuration in Angular apps either (you can see here angular/angular-cli#22849 (comment)). Again, this is a limitation on the underlying Angular tech used by the Nx executors to build projects. You can still configure PostCSS by using a custom webpack configuration. |
I tried custom webpack config with
Are there any pitfalls with overwriting the rule for css-files? |
@zvnt you need to be careful not to overwrite the default Angular CLI webpack configuration for styles. The above will replace the rule configuration for the module.exports = config => {
// add your logic here updating the config
}; That way, you can obtain the specific rule(s) you want to update from the base configuration and make the needed changes without losing any functionality. You can take a look at some docs/examples updating the webpack config in a similar way to get an idea: https://indepth.dev/posts/1294/angular-css-modules |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
I created new nx/angular project with tailwind and storybook. All works fine, but now I need to add postcss nesting plugin, like
postcss-nested
ortailwindcss/nesting
.I created
postcss.config.js
in my app and lib directory with following configCurrent Behavior
I got "Nested CSS was detected, but CSS nesting has not been configured correctly.
Please enable a CSS nesting plugin before Tailwind in your configuration." message in build log. Seems like nx doesn't respect postcss.config.js.
Expected Behavior
Should be possibe to add postcss-plugins.
Environment
The text was updated successfully, but these errors were encountered: