π¨π½βπ¬ feature: theme.json handlers #1199
Merged
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.
I had to do something fun.
A HUGE part of the size of this PR from me converting the
theme.json
schema to typescript declarations.Overview
This is included as part of
@roots/sage
. It adds some support for configuringtheme.json
using values coming from other parts of the build. Using these functions will cause a newtheme.json
to be written on every build.Use: supply
bud.themeJson
with a callback supplying custom values. This will be used to emittheme.json
in the project root after successful compilation:If you don't want the container API you can request the raw object:
If you use
tailwindcss
you can also usebud.useTailwindColors
in tandem with this:Which will grab the colors for
theme.json
fromtheme.extends.colors
intailwind.config.js
. It supports color variants or a simple mapping.name
is the titlecasedslug
.default
the variant key will be discarded.{eevee: {default: '#000'}}
will be get the nameEevee
and the slug will beeevee
.Example input/output:
If one were to want more control they can export the functions used to do the color mapping from
@roots/sage
and handle it themselves:refers: none
closes: none
Type of change
This PR includes breaking changes to the following core packages:
This PR includes breaking changes to the follow extensions:
Dependencies
Adds
Removes