[wp-trac] [WordPress Trac] #58588: `wp_get_global_styles`: allow transform variables into its raw values

WordPress Trac noreply at wordpress.org
Wed Jun 21 08:28:53 UTC 2023


#58588: `wp_get_global_styles`: allow transform variables into its raw values
-------------------------+--------------------
 Reporter:  oandregal    |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  6.3
Component:  Themes       |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+--------------------
 Related Gutenberg ticket:
 https://github.com/WordPress/gutenberg/issues/49712.

 In some scenarios (mobile, mail, etc.) the CSS Custom Properties are not
 supported and/or it is more convenient to operate with the raw values they
 represent. However, `wp_get_global_styles`, the public API for styles
 coming from `theme.json`, returns the values as they are.

 Core should provide a way to transform the CSS Custom Properties into the
 raw values they represent.


 For example, the following data coming from a `theme.json`:


 {{{
 "core/post-terms": {
     "typography": { "fontSize": "var(--wp--preset--font-size--small)" }
 }
 }}}


 The expected result for `wp_get_global_styles` is:


 {{{#!php
 <?php
 (
     [typography] => Array( [fontSize] => var(--wp--preset--font-size--
 small) )
 )

 }}}


 By transforming variables into values, the expected result would be
 (provided the small font size preset had been defined as 12px):

 {{{#!php
 <?php
 (
     [typography] => Array( [fontSize] => "12px" )
 )

 }}}


 Both scenarios need to be supported and the normal path is to return the
 CSS Custom Properties.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58588>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list