This repository was archived by the owner on Feb 17, 2025. It is now read-only.
Experiment to render 'default css variables' for a child theme #3510
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.
An experiment to discern if/how a child theme of BCB can make use of the parent theme's defined "custom" values (without defining them itself).
This change renders the 'custom' css variables exactly how Gutenberg/Global Styles will and enqueues them BEFORE the Gutenberg rendered Global Styles CSS variables are rendered.
In this way all of the "custom" variables are guaranteed to be defined even if not explicitly set in the child theme's theme.json file. But if they ARE provided then those generated by Gutenberg will take priority.
This utility will no longer be necessary when a CHILD theme is able to extend a PARENT theme's theme.json file.
To evaluate:
Execute the new script (
npm run build:defaultVariableswithin the BCB project, ornpm run buildto build it along with the SCSS ORnpm startdo do the same and rebuild on changes). Note that the CSS variables in /assets/generatedDefaultVariables.css matches what is expressed in the BCB theme.json file's 'custom' block)Load BCB and note that this CSS file AND the inline CSS files generated by Global Styles matches.
Activate the "Seedlet Blocks" theme and load a view page.
Note that ALL of the variables in "custom" are provided and available for the SCSS to use, but that the Seedlet-blocks theme.json file ONLY has variables for the colors. Note that the 'secondary' color maps to what Seedlet-blocks expresses (green) and NOT what BCB expresses (blue).
I don't necessarily expect to keep the "Seedlet-blocks" changes in this change, however a child theme was necessary to test this behavior. Likely it should be removed before we bring this change in (and advanced separately).