WP_Style_Engine_Processor::get_css()
Gets the CSS rules as a string.
Метод класса: WP_Style_Engine_Processor{}
Хуков нет.
Возвращает
Строку
. The computed CSS.
Использование
$WP_Style_Engine_Processor = new WP_Style_Engine_Processor(); $WP_Style_Engine_Processor->get_css( $options );
- $options(массив)
An array of options.
По умолчанию: empty array
-
optimize(true|false)
Whether to optimize the CSS output, e.g. combine rules.
По умолчанию: false - prettify(true|false)
Whether to add new lines and indents to output.
По умолчанию: whether the SCRIPT_DEBUG constant is defined
-
Список изменений
С версии 6.1.0 | Введена. |
С версии 6.4.0 | The Optimization is no longer the default. |
Код WP_Style_Engine_Processor::get_css() WP Style Engine Processor::get css WP 6.7.2
public function get_css( $options = array() ) { $defaults = array( 'optimize' => false, 'prettify' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG, ); $options = wp_parse_args( $options, $defaults ); // If we have stores, get the rules from them. foreach ( $this->stores as $store ) { $this->add_rules( $store->get_all_rules() ); } // Combine CSS selectors that have identical declarations. if ( true === $options['optimize'] ) { $this->combine_rules_selectors(); } // Build the CSS. $css = ''; foreach ( $this->css_rules as $rule ) { // See class WP_Style_Engine_CSS_Rule for the get_css method. $css .= $rule->get_css( $options['prettify'] ); $css .= $options['prettify'] ? "\n" : ''; } return $css; }