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.
This PR is based on the code in PR #19 as it is dependant
I added a new configuration option to enable WordPress 5.8 theme.json support.
Hopefully the updated README explains everything pretty well, but essentially there is a new configuration option,
wp_theme_json
which when enabled, will try and load theoutput
option, then append the palette in the right place (settings.color.palette
).With this option, the user does not need to
add_theme_support
for a palette, and all required classes for the block editor are compiled automatically (as detailed in https://make.wordpress.org/core/2021/06/25/introducing-theme-json-in-wordpress-5-8/)Edit: After submitting this PR, I realised that if the user isn't using mix with a
setPublicPath
, forcing the output path to"../" + output
would put the file in the wrong place, so I added another new propertyoutput_prepend
which just gets prepended tooutput
to support writing theme.json outside of/public
for those using mix/roots/sage, etc.