-
Notifications
You must be signed in to change notification settings - Fork 269
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
Colors defined as functions cause error #143
Comments
Hey! Thank you for your bug report! Looking at your error confuses me are you writing the JavaScript code inside your |
Thanks for the follow-up, Robin! Unfortunately, I can't reproduce it in the playground since it's not updated to v2.0.3. There was bug fix tailwindlabs/tailwindcss#2919 that added support for functions as colors that wasn't merged until the latest patch release. Therefore, trying to reproduce it on the current playground would give you a different error. Will create minimal reproduction soon when I get time. In the meantime, here's the full config that's producing it. https://github.com/Nick-Mazuk/ui-config/blob/master/tailwind.js |
Just ran into this error myself when following that same guide on how to use CSS variables and opacity. Super confusing. Only discovered the source because I pretty much randomly decided to comment out the typography plugin. Once I did, the error went away immediately. It seems the function definition gets merged into the CSS, or something weird like that? I've seen both the |
Here's a fairly minimal reproduction using Next.js: If you comment out this line, you should be getting this error:
|
crswll on Discord was able to figure out the issue probably happens here: Crash seems to happen when using |
Fairly sure that's it. |
I've had the same issue after following this guide: https://github.com/adamwathan/tailwind-css-variable-text-opacity-demo It's a guid to get css variables for colors working with the opacity modifiers of tailwind. It basically makes But as @Nick-Mazuk stated, that "bug" on line 1109 in the typography plugin makes my build fail. It just gets the value (which is a function) without evaluating it first (like all other places where tailwind loads a color from the config. After i removed the function from my 600 color, it worked again. I don't know how to fix that line here: https://github.com/tailwindlabs/tailwindcss-typography/blob/master/src/styles.js#L1109-L1110 any ideas? |
Anyone looking for a quick fix, this worked for me: add this to your config under theme > extend:
this makes it work with This will create this CSS for the typography plugin:
What this does: Hope that helps :) |
@Nick-Mazuk Just checked this with the latest typography plugin and Tailwind CSS v3.0 and does not look to be an issue anymore. @Svish thanks for the repro! Was helpful! |
If you define colors as functions, it breaks
@tailwind/typography
.This code works correctly on Tailwind v1.9
Metadata
The text was updated successfully, but these errors were encountered: