Skip to content

Commit

Permalink
Remove readme doc for now since it won't be in core for a while.
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Dec 19, 2022
1 parent da1093d commit 627d8a6
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions packages/style-engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ _Parameters_
- _context_ `string` An identifier describing the origin of the style object, e.g., 'block-supports' or 'global-styles'. Default is 'block-supports'. When both `context` and `selector` are set, the Style Engine will store the CSS rules using the `context` as a key.
- _convert_vars_to_classnames_ `boolean` Whether to skip converting CSS var:? values to var( --wp--preset--\* ) values. Default is `false`.
- _selector_ `string` When a selector is passed, `generate()` will return a full CSS rule `$selector { ...rules }`, otherwise a concatenated string of properties and values.
- _metadata_ `array` An associate array in the format of WP_Style_Engine::BLOCK_STYLE_DEFINITIONS_METADATA that extends the latter.

_Returns_
`array<string|array>|null`
Expand Down Expand Up @@ -88,43 +87,6 @@ array(
*/
```

The default block style support definitions can be extended by passing metadata in the options.

```php
$block_attributes = array(
'style' => array(
'layout' => array( 'float' => 'left' ),
),
);

$styles = wp_style_engine_get_styles(
$block_attributes['style'],
array(
'selector' => '.a-selector',
'metadata' => array(
'layout' => array(
'float' => array(
'property_keys' => array(
'default' => 'float',
),
'path' => array( 'layout', 'float' ),
),
),
)
)
);
print_r( $styles );

/*
array(
'css' => '.a-selector{float:left}'
'declarations' => array( 'float' => 'left' )
)
*/
```

Note: CSS properties must be supported by [safecss_filter_attr](https://developer.wordpress.org/reference/functions/safecss_filter_attr/), otherwise you can allow non-supported CSS using the filter [safecss_filter_attr_allow_css](https://developer.wordpress.org/reference/hooks/safecss_filter_attr_allow_css/).

### wp_style_engine_get_stylesheet_from_css_rules()

Use this function to compile and return a stylesheet for any CSS rules. The Style Engine will automatically merge declarations and combine selectors.
Expand Down

1 comment on commit 627d8a6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3728725540
📝 Reported issues:

Please sign in to comment.