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

Theme extend arrays are not merged #2798

Closed
flybayer opened this issue Nov 18, 2020 · 6 comments
Closed

Theme extend arrays are not merged #2798

flybayer opened this issue Nov 18, 2020 · 6 comments

Comments

@flybayer
Copy link

flybayer commented Nov 18, 2020

Describe the problem:

v2 now deeply merges theme extensions, so I also expected arrays to be merged.

I.e. I want the below to keep the default fontFamily.sans config but add Inter Var to the beginning.

module.exports = {
  theme: {
    extend: {
      fontFamily: {
        sans: ["Inter var"],
      },
    },
  },
}

Link to a minimal reproduction:

https://play.tailwindcss.com/VWhUl3yiv2?file=config

@jacobdalamb
Copy link

jacobdalamb commented Nov 18, 2020

put const defaultTheme = require('tailwindcss/defaultTheme'); at the top before module.exports & ['Inter var', ...defaultTheme.fontFamily.sans]`

@flybayer
Copy link
Author

Yeah, that's what I'm doing as a workaround.

@jacobdalamb
Copy link

(arrays like in fontFamily are not deep merged)
#2679

@flybayer
Copy link
Author

Yeah, I know. I'm suggesting that be changed :)

The docs indicated that everything would be merged, hence why I initially thought this was a bug.

@jacobdalamb
Copy link

Yeah, I know. I'm suggesting that be changed :)

The docs indicated that everything would be merged, hence why I initially thought this was a bug.

Ohhh gotcha

@adamwathan
Copy link
Member

@flybayer If we merged arrays you couldn't override a single font-family without overriding all of them and not using extend. It's also unintuitive that arrays are merged by adding things to the beginning (makes sense for font-family, but that feels like an edge-case).

It would also be annoying if you wanted to override the shadow-xl shadow without your own shadow-xl only to find that your shadows were combined (since shadows can be defined as arrays too).

So no plans to change this for now unfortunately.

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

3 participants