-
Describe the problem:I'm trying to use Tailwind in my Angular 10 project which failes with the following errors:
Here are the steps I took:
Added those at the beginning of styles.scss:
Created this webpack.config.js in the root of my project:
Used those to update my angular.json:
Then serve the app using:
The error exists with Angular 9.1.12 (LTS) as well as 10.1.2. |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments 11 replies
-
There is a problem with postcss 8.0.7. Downgrade to postcss 8.0.6. |
Beta Was this translation helpful? Give feedback.
-
I never actually installed postcss - it just came as a dependency with the highest version of 7.0.32 |
Beta Was this translation helpful? Give feedback.
-
found this issue as well, same reproduction step |
Beta Was this translation helpful? Give feedback.
-
Fixed it:
Version 3.0.0 of postcss-scss seems to break things. I would highly appreciate you putting up some guide on how to implement Tailwind with Angular. There's a bunch of tutorials on the web - half of them outdated/wrong. Keep up the great work! |
Beta Was this translation helpful? Give feedback.
-
Glad you got it sorted out! I'd love to put together a guide on integrating Tailwind with Angular but have never actually used Angular so don't know where to start. If anyone wants to share an example repo that they think is the best possible setup (given how Angular doesn't allow you to customize the PostCSS config if I'm not mistaken), I'd love to use it as a starting point to come up with something we can endorse. |
Beta Was this translation helpful? Give feedback.
-
@adamwathan https://medium.com/@jacobneterer/angular-and-tailwindcss-2388fb6e0bab this is one of the most up-to-date article about tailwind + angular. |
Beta Was this translation helpful? Give feedback.
-
@nartc And even that one is outdated and wrong. For example the postcss-loader does not have an "options" parameter, it's "postcssOptions". And that's just one. |
Beta Was this translation helpful? Give feedback.
-
@paranerd, it would be great! |
Beta Was this translation helpful? Give feedback.
-
By the way, it seems that instead of: it should be: |
Beta Was this translation helpful? Give feedback.
-
@cssberries How would you like me to set up the guide? |
Beta Was this translation helpful? Give feedback.
-
@paranerd I think it could be similar to what was mentioned above but up to date and right. |
Beta Was this translation helpful? Give feedback.
-
Hey - moving this to GitHub discussions to keep the conversation going 👍 |
Beta Was this translation helpful? Give feedback.
-
I put up an article on my blog describing how to set things up 🙂 |
Beta Was this translation helpful? Give feedback.
-
I find using the Tailwind CLI to be easier with Angular. |
Beta Was this translation helpful? Give feedback.
-
I have used this one for a couple of times now. |
Beta Was this translation helpful? Give feedback.
I put up an article on my blog describing how to set things up 🙂