-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Allow users to override a core plugin's configuration #644
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
Conversation
@adamwathan So by this PR you have 2 ways of defining the wanted variants? |
Sort of — if you specify an object for a plugin in the These two config files produce the same result: // Config A
module.exports = {
theme: {
opacity: {
'0': '0',
'50': '.5',
'100': '1',
}
},
variants: {
opacity: ['responsive', 'hover'],
}
}
// Config B
module.exports = {
corePlugins: {
opacity: {
variants: ['responsive', 'hover'],
values: {
'0': '0',
'50': '.5',
'100': '1',
}
},
} There's no real benefit to this currently because every plugin option is already available via Really the only other reason I've made this work is because we have this Maybe it's pointless though and |
@adamwathan Isn't that a bit confusing to have 2 different ways of doing the same thing? 🤔 I understand the "additional options" idea, but find the possibility to have them in both Just my 2c btw, glad you're taking so much time to provide us with a nice API and a nice framework tho! 😉 |
Yeah I wouldn't think of it as having two ways to do the same thing, they are really two separate things:
So while you can use 2 to do what you're supposed to do with 1, the purpose isn't really to give you two ways to do the same thing, it's just to give you an escape hatch if for whatever reason in the future it makes sense for people to directly configure a plugin. Think of the |
@adamwathan If you look at it that way, it's indeed less confusing. Thanks for taking your time Adam! 😉 |
This PR makes it possible for users to completely override a core plugin's configuration by providing a configuration object in the
corePlugins
section of the config file.This configuration overrides any configuration that would be derived from the
theme
andvariants
sections.Right now this isn't really useful but it's part of the vision outlined in #637. It's at least necessary to be able to set a core plugin to
false
to disable it, and it's very possible that in the future some core plugins expose additional advanced configuration that is only accessible throughcorePlugins
for users who want to do something very custom (like change a class name) and deviate from the Tailwind's defaults significantly.