Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Conversation

@pbking
Copy link
Contributor

@pbking pbking commented Mar 22, 2021

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:defaultVariables within the BCB project, or npm run build to build it along with the SCSS OR npm start do 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).

@scruffian
Copy link
Member

My concern with this approach is that it still doesn't help with things defined in the styles area. I took a stab at adding support to Gutenberg: WordPress/gutenberg#30147

@pbking
Copy link
Contributor Author

pbking commented Mar 23, 2021

I wholeheartedly agree, and the styles bit was something I was thinking through last night. I came up with an EVEN HACKIER solution that I like even less. The gutenberg path is (IMO) the only path forward.

I'm glad to have evaluated this so that I better understand that we shouldn't be doing it this way. :P

@pbking
Copy link
Contributor Author

pbking commented Mar 23, 2021

Closing in lieu of WordPress/gutenberg#30147

@pbking pbking closed this Mar 23, 2021
@scruffian scruffian deleted the make/seedlet-bcb-blocks branch March 23, 2021 16:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Blank Canvas Blocks] Evaluate 'base' CSS variable generation

3 participants