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

CSS fallback values from Tailwind config extend are missing #852

Open
claudiopedrom opened this issue Mar 4, 2024 · 2 comments
Open

CSS fallback values from Tailwind config extend are missing #852

claudiopedrom opened this issue Mar 4, 2024 · 2 comments

Comments

@claudiopedrom
Copy link

claudiopedrom commented Mar 4, 2024

Hello,

In my project (styled-components w/ Tailwind CSS), I'm using the svh unit.
As I still have to support some old browsers (Chrome 107), I'm extending the Tailwind config like this:

extend: {
  height: {
    screen: ["100vh", "100svh"],
  },
}

But I just noticed that the 100vh is never added to the final CSS. It always ends up in something like this:

.className {
  /* no 100vh value */
  height: 100svh;
}

It seems to work as expected in a "classic" Tailwind setup:

Another way to reproduce this is by adding a utility, for example:

const plugin = require('tailwindcss/plugin')

// (...)

plugins: [
  plugin(function ({ addBase, addComponents, addUtilities, theme }) {
    addUtilities({
      '.foo': {
        color: ['red', 'blue'],
      }
    })
  })
],

When tw="foo" is used, only the blue color is present.

I was not able to find any issue regarding this.
So, I'm not sure if it only happens to me or if there is something I need to change/update to make it work.

@ben-rogerson
Copy link
Owner

Hey there

As you've probably noticed - that the types indicate that an array is invalid for values on height:

image

So makes sense to me that the value shouldn't be allowed.

That said, it should work but we're working in JavaScript here and these styles are all placed within objects.
In Javascript, duplicate keys are not allowed so producing css like this isn't possible:

image

I've yet to come up with a workaround on this - but please let me know if you come up with something.

@claudiopedrom
Copy link
Author

Ah, yes, that makes sense. For now, I have created a "utility" class directly in the global CSS file. This is not the best solution, but it is a quick solution.

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

No branches or pull requests

2 participants