Theme JSON: abstract style/CSS logic and utilities #65728
Labels
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
[Package] Style Engine
/packages/style-engine
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
I believe there is some styles-related utility logic that could be abstracted away from WP_Theme_JSON.
Maybe some other specific theme logic as well 🤷🏻
WP_Theme_JSON
and its test suites are very large and difficult to grok for newcomers, and, I'd wager, their size often contributes the friction one experiences when synching changes between Gutenberg and Core, not to mention frightening new contributions.Not to mention the fact that, as it ages, it grows even bigger as it accommodates changes in the way WordPress expresses CSS/interprets theme.json.
Related:
WP_Theme_JSON
related classes and helpers are maintained #62594 (comment)What is your proposed solution?
@oandregal made a valid point in relation to the separation of concerns:
The style engine is sitting quietly in the corner doing its thing.
It already shares some minor style utilities with theme JSON, e.g., preset var parsing and CSS rule sanitization, and I believe its scope can be widened to house theme.json tree style processing and output.
Possibly, a new class could handle theme.json tree consumption, e.g.,
class-wp-style-engine-theme.php
Below is a very rough start of an audit of current methods:
I'd propose a gentle introduction would be to:
The text was updated successfully, but these errors were encountered: