Easier way to extend default theme #756
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Tailwind will now export resolved default configuration allowing users to more intuitively extend the theme.
Currently, users have to use the special
extend
section of the theme object to accomplish this.Resolving of the computed values
Previously, only root level values would be resolved. I changed the resolution logic to be recursive as I feel it is more intuitive and easier to explain in documentation.
Note on the new dependency
I created a new NPM module for this specific purpose and added it as a dependency. This solves the issue of maintaining none ES6 code in an ES6 codebase.
The resolution of the default configuration needs to be accessible before babelification to allow projects depending on Tailwind to properly import it. Additionally, Tailwind needs to use the same code when resolving user-provided configuration files. By moving the bulk of the generic code into a separate package, we don't have to run code from outside of the
src
directory or put none ES6 code in thesrc
directory.