-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Support new presets
key + extending core plugins config
#2474
Conversation
To do: consider changing to a preset key instead of an array config, and make sure it works recursively. |
600523d
to
401e629
Compare
presets
key + extending core plugins config
Updated to drop the top level array format and instead use a |
return configurePlugins(corePluginConfig, Object.keys(corePluginList)).map(pluginName => { | ||
return corePluginList[pluginName]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return configurePlugins(corePluginConfig, Object.keys(corePluginList)).map(pluginName => { | |
return corePluginList[pluginName]() | |
return configurePlugins(corePluginConfig, Object.values(corePluginList)).map(plugin => { | |
return plugin() |
Since |
Nope, the resolution logic is quite complex because of things like function values and the “extend” theme key. Check out the tests for resolveConfig 😳 |
f3893d1
to
55dcc53
Compare
I'm waiting for the day when Bootstrap is completely beaten. Then we can rule the world again!! Tailwind CSS should really rule the web cause it's really better than others and has better taste. As all fathers say: Be patient son! |
401e629
to
75dfa4e
Compare
@adamwathan I am not really sure of the usage target of this feature. I have a As you can see on this version, I require some part of the default theme then merge them using the spread operators. Will your feature help me on that case or should I keep my configuration like this? The goal of this config is also to be re-used on other project containing a tailwind configuration. In a more general way, will some documentation be added about this feature? Regards |
You can use this feature to specify your custom config file as the base for any projects you work on like this: // tailwind.config.js
module.exports = {
presets: [require('./custom-base-config.js')],
// ...
} Can you explain more clearly what your question is? How were you extending your base config in your projects up until now? |
@adamwathan The main goal is to maintain one common Tailwind configuration under our design project and maybe add some specific override on front projects. |
By the way, I maybe didn't understand the goal of this feature, but I tried this: presets: [
require('tailwindcss/defaultConfig'),
require('nexylan-design/tailwind.config.js'),
], And the design is completely broken. However, if I remove the custom one, everything works well but without my theme (of course). |
This PR adds support for adding a
presets
key to your Tailwind config to make it possible to ignore Tailwind's default config file.This configuration is identical to Tailwind's default behavior, and this is what happens if the
presets
key is omitted:This configuration removes Tailwind's default config from the list of configs to resolve, essentially disabling all defaults:
This configuration specifies a custom base config file, useful if you have a config you share across different properties at your company:
Multiple presets can be applied, and they will be resolved in order, with presets at the end taking precedence over presets at the beginning:
Presets can also have their own presets, so the above configuration could be rewritten like this:
This PR also adds better support for merging the
corePlugins
key, so now your custom default config can specify the core plugins you want to enable while still being able to extend it in a project specific config:If you'd like to add core plugins to your base config, you can use a function syntax that receives the so-far-resolved
corePlugins
array as a destructurable argument:We may add helpers like
after
andbefore
in the future, to mimic the API that is available for variants.This PR in general is in service of introducing a new "lite" config mode for Tailwind, for folks who want a more minimal starting point.