Skip to content
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

TailwindCSS 2.0.1 requires PostCSS 8: build breaks if Tailwind added via gatsby-plugin-sass #28328

Closed
Hahlh opened this issue Nov 27, 2020 · 12 comments
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@Hahlh
Copy link
Contributor

Hahlh commented Nov 27, 2020

Description

The group-hover defaults are not working (like textColor and backgroundColor) and following the docs and specifying them in the config doesn't seem to take effect.

image

If specified in tailwind.config.js under variants > extend as shown in the docs, the changes don't have effect:
image

@Hahlh Hahlh added the type: bug An issue or pull request relating to a bug in Gatsby label Nov 27, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 27, 2020
@Hahlh
Copy link
Contributor Author

Hahlh commented Nov 27, 2020

The solution to this is to also add 'hover', not only 'group-hover'.

The defaults are overridden and 'hover' is one of them.

I found the solution while creating this issue, but decided to open this issue nevertheless for the befit of future generations.
May that spare them some valuable minutes.

Another point would be of course, why the defaults for group-hover, that normally shouldn't be needed to be added are not working, but I will close this issue for the time being until I have further investigated.

@Hahlh Hahlh closed this as completed Nov 27, 2020
@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 28, 2020
@Hahlh
Copy link
Contributor Author

Hahlh commented Nov 28, 2020

Okay, I actually have to reopen this issue.

Apparently the difference is indeed, that variants don't take effect, if applied via extend.
They are only applied, if added directly under variants.

image

I will add to this, that apparently the defaults, that according to the docs should be working without any changes to the config, are not:
image

@Hahlh Hahlh reopened this Nov 28, 2020
@LekoArts
Copy link
Contributor

Please open this on TailwindCSS repository, this one here is specific for issues with Gatsby.

@Hahlh
Copy link
Contributor Author

Hahlh commented Nov 29, 2020

Hey @LekoArts !
Thanks you for looking at this issue.

Apparently TailwindCSS updated to 2.0 a couple of days ago, which included the possibility to use 'extend' for variants.

Changing the version manually in package.json allows to update to TailwindCSS 2.0.1, but that breaks building as PostCSS 8 is required.

Looking at this issue, gatsby-plugin-postcss started to use PostCSS 8 beginning with 3.0.0.

If you use gatsby-plugin-sass (Option #3 in the Gatsby docs) for making TailwindCSS work, the dependency is not satisfied.

I reverted back to tailwindcss@^1.9.6 for the moment, which works fine if you don't follow the Tailwind docs and use 'extend', but add the variants directly.

@Hahlh Hahlh changed the title TailwindCSS: group-hover defaults not working and if specified in tailwind.config.js > variants > extend TailwindCSS 2.0.1 requires PostCSS 8: build breaks if Tailwind added via gatsby-plugin-sass Jan 17, 2021
@Hahlh
Copy link
Contributor Author

Hahlh commented Jan 17, 2021

@LekoArts

I changed the title to reflect my new understanding of this issue.
Any update regarding this?

image

Related stackoverflow thread and related docs, if Tailwind > 1.9.6 is required.

@Kevsonschouten
Copy link

Hi,

Joining in, because I'm experiencing the exact same issue.
image

Might be overseeing something here, but as i understand I'm having all the correct versions?
image

Thanks in advance for helping out.

@Hahlh
Copy link
Contributor Author

Hahlh commented Feb 6, 2021

@Kevsonschouten A temporary easy fix is to use the Tailwind compatibility build.

npm uninstall tailwindcss postcss autoprefixer 
npm install tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9

Once the issue has been resolved:

npm uninstall tailwindcss @tailwindcss/postcss7-compat
npm install tailwindcss@latest postcss@latest autoprefixer@latest

@Hahlh
Copy link
Contributor Author

Hahlh commented Feb 9, 2021

@Kevsonschouten
Copy link

Hi Hahlh , I’ve got things working. Thank you !

@austonpramodh
Copy link

austonpramodh commented Mar 7, 2021

Hi Hahlh , I’ve got things working. Thank you !

Hi, I am facing the same problem. Can you please tell me how did you get it fixed?

@Hahlh
Copy link
Contributor Author

Hahlh commented Mar 7, 2021

Hi Hahlh , I’ve got things working. Thank you !

Hi, I am facing the same problem. Can you please tell me how did you get it fixed?

Hey @austonpramodh. Hope you had a great weekend!

I described two solutions above. Did you try to implement them and ran into problems?

@austonpramodh
Copy link

austonpramodh commented Mar 7, 2021

Hi @Hahlh. I did have a great weekend playing around with tailwind and gatsby. Thanks for asking.

hope you had a great weekend too.

I tried solution no 2 - using tailwind with postcss7. At first, npm didn't allow me to downgrade the postcss. This was because i had gatsby-plugin-postcss installed. I uninstalled gatsby-plugin-postcss and followed your solution, configured gatsby config following Tailwind with Gatsby and it worked.

So the complete steps would be to follow Tailwind with Gatsby with option#3. Then use the Your solution to install tailwind-postcss7.
image

Hope this helps others too.

Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

4 participants