WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Pelago\Emogrifier

CssInliner::extractImportAndCharsetRules() private WC 1.0

Extracts @import and @charset rules from the supplied CSS. These rules must not be preceded by any other rules, or they will be ignored. (From the CSS 2.1 specification: "CSS 2.1 user agents must ignore any '@import' rule that occurs inside a block or after any non-ignored statement other than an @charset or an @import rule." Note also that @charset is case sensitive whereas @import is not.)

{} Это метод класса: CssInliner{}

Хуков нет.

Возвращает

Строку[]. The first element is the CSS with the valid @import and @charset rules removed. The second element contains a concatenation of the valid @import rules, each followed by whatever whitespace followed it in the original CSS (so that either unminified or minified formatting is preserved); if there were no @import rules, it will be an empty string. The (valid) @charset rules are discarded.

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

// private - только в коде основоного (родительского) класса
$result = $this->extractImportAndCharsetRules( $css );
$css(строка) (обязательный)
CSS with comments removed

Код CssInliner::extractImportAndCharsetRules() WC 5.4.1

<?php
private function extractImportAndCharsetRules($css)
{
    $possiblyModifiedCss = $css;
    $importRules = '';

    while (
        \preg_match(
            '/^\\s*+(@((?i)import(?-i)|charset)\\s[^;]++;\\s*+)/',
            $possiblyModifiedCss,
            $matches
        )
    ) {
        list($fullMatch, $atRuleAndFollowingWhitespace, $atRuleName) = $matches;

        if (\strtolower($atRuleName) === 'import') {
            $importRules .= $atRuleAndFollowingWhitespace;
        }

        $possiblyModifiedCss = \substr($possiblyModifiedCss, \strlen($fullMatch));
    }

    return [$possiblyModifiedCss, $importRules];
}