API / Minn\Theme / CustomCss

CustomCss final class

Minn\Theme\CustomCss · public/minn/src/Minn/Theme/CustomCss.php · 69 lines

Custom CSS as theme.json and blocks write it (a styles node's "css", a block's style.css): nested rules under "&" unfolded beneath the selector they belong to, each wrapped in :root :where() as the reference prints them. Pure: CSS and selectors in, rules out.

Public

staticscoped(string $css, string $selector): string#

A block's own CSS under its selector (probe editor-styles; a block's style.css too, probe block-supports), split at each ampersand: a part with no rule applies to the block itself; a nested selector that starts with a space is scoped, every comma part after the block's selector; any other is appended to it; a pseudo element moves to the end, outside :where().

staticofStyles(array $styles): string#

The styles' own CSS (WP_Theme_JSON::get_custom_css): the top-level css, then each block's under its root selector.

$stylesarray<string, mixed>

Internals 2

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatescope(string $scope, string $selector): string#

Every comma part of a selector list after every part of the scope.

privateappend(string $selector, string $suffix): string#

Text appended to every comma part of a selector list.