WP_Style_Engine::compile_stylesheet_from_css_rules()public staticWP 6.1.0

Returns a compiled stylesheet from stored CSS rules.

Метод класса: WP_Style_Engine{}

Хуков нет.

Возвращает

Строку. A compiled stylesheet from stored CSS rules.

Использование

$result = WP_Style_Engine::compile_stylesheet_from_css_rules( $css_rules, $options );
$css_rules(WP_Style_Engine_CSS_Rule[]) (обязательный)
An array of WP_Style_Engine_CSS_Rule objects from a store or otherwise.
$options(массив)

An array of options.

По умолчанию: empty array

  • context(строка|null)
    An identifier describing the origin of the style object, e.g. 'block-supports' or 'global-styles'. When set, the style engine will attempt to store the CSS rules.
    По умолчанию: 'block-supports'

  • 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 Введена.

Код WP_Style_Engine::compile_stylesheet_from_css_rules() WP 6.5.2

public static function compile_stylesheet_from_css_rules( $css_rules, $options = array() ) {
	$processor = new WP_Style_Engine_Processor();
	$processor->add_rules( $css_rules );
	return $processor->get_css( $options );
}