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

Disabling an opacity plugin breaks support for custom property colors #5458

Closed
stefanfisk opened this issue Sep 9, 2021 · 2 comments · Fixed by #5470
Closed

Disabling an opacity plugin breaks support for custom property colors #5458

stefanfisk opened this issue Sep 9, 2021 · 2 comments · Fixed by #5470

Comments

@stefanfisk
Copy link
Contributor

What version of Tailwind CSS are you using?

2.2.7

What build tool (or framework if it abstracts the build tool) are you using?

Tailwind Play

What version of Node.js are you using?

n/a

What browser are you using?

n/a

What operating system are you using?

n/a

Reproduction repository

https://play.tailwindcss.com/YVjDQE13bj

Describe your issue

Colors defined by a function as described in https://github.com/adamwathan/tailwind-css-variable-text-opacity-demo break for plugins where the associated opacity plugin is disabled.

This is caused by the plugins not calling withAlphaVariable() when opacity plugins are disabled:

'background-color': value,
. Since the function

This behaviour makes it impossible to selectively disable opacity plugins when using colors defined via functions.

Since the example repo shows how the function is expected to support the case where neither opacityVariable nor opacityValue are provided, I would expect it to work.

@stefanfisk
Copy link
Contributor Author

A workaround is to provide an empty theme instead of disabling the opacity plugin, for example backgroundOpacity: {}.

@adamwathan
Copy link
Member

Thanks, fixed in #5470! This fix probably won't land in 2.x unfortunately as we are working on 3.0 on master now, but you can use your workaround for now at least. Personally I would just not bother disabling the opacity plugins and let PurgeCSS strip that stuff out 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants