You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a tracking issue for implementing a Style Engine as discussed in improving our saving/rendering of block styles. The goal is to have a consistent API for rendering styling for blocks, across both client-side and server-side applications. The server implementation is preferred for a site's frontend.
Rather than a monolithic refactor, the aim should be to build the smallest implementation possible and land it in the plugin, and iteratively enhance it with small PRs as we go.
In principle, the style engine should be able to receive a style object, and return the rendered styling for that style object, along with any required class names or other data needed to reassemble or use those styles in all required environments. Depending on the implementation, it may be possible for us to avoid or minimise the current reliance on rendering inline styles directly into block markup.
⭐ Current phase - Phase 1: block styles consolidation and refactoring the layout abstraction
Goals:
To audit and consolidate where the code generates block support CSS in the backend so that they are delivered from the same place (as opposed to multiple places). This covers CSS rules such as margin and padding, typography, colors and borders.
Removing repetitive layout-specific styles and generating semantic class names for each layout.
The below to-do list is an assortment of shorter-term to longer-term features that would be great to implement. We should aim to not let the longer-term goals block landing the shorter-term goals — but let's try to use the longer-term goals to inform the design decisions for the shorter-term ones.
The approach will be work iteratively rather than treating this as a project that needs to be complete all at once.
Refactor Global/theme.json styles to use the style engine (if at all relevant). Backend in WP_Theme_JSON class, and frontend in packages/edit-site/src/components/global-styles/use-global-styles-output.js. See Style engine: output global styles CSS rules using selectors #40955
Explore adding support for nested style objects, scoped by pseudo class or media query (to add support for hover/active styles, or potentially different styles based on viewport size)
This is a tracking issue for implementing a Style Engine as discussed in improving our saving/rendering of block styles. The goal is to have a consistent API for rendering styling for blocks, across both client-side and server-side applications. The server implementation is preferred for a site's frontend.
Rather than a monolithic refactor, the aim should be to build the smallest implementation possible and land it in the plugin, and iteratively enhance it with small PRs as we go.
In principle, the style engine should be able to receive a style object, and return the rendered styling for that style object, along with any required class names or other data needed to reassemble or use those styles in all required environments. Depending on the implementation, it may be possible for us to avoid or minimise the current reliance on rendering inline styles directly into block markup.
⭐ Current phase - Phase 1: block styles consolidation and refactoring the layout abstraction
Goals:
Planning discussions
To-do
The below to-do list is an assortment of shorter-term to longer-term features that would be great to implement. We should aim to not let the longer-term goals block landing the shorter-term goals — but let's try to use the longer-term goals to inform the design decisions for the shorter-term ones.
The approach will be work iteratively rather than treating this as a project that needs to be complete all at once.
stylevs. describingstate#38694styledifferences in block validation: Ignore style validation errors #37942uniqid()in generated CSS class names breaks ability to cache parsed CSS #38889WP_Theme_JSONclass, and frontend inpackages/edit-site/src/components/global-styles/use-global-styles-output.js.See Style engine: output global styles CSS rules using selectors #40955ELEMENTSconst to style engine once we've dealt with JS global stylesProject board
We've started a project board for managing the above tasks over in: Gutenberg Style Engine (view)
Relevant discussions
stylevs. describingstate#38694