$contents =
mb_substr(Unicode::
convertToUtf8($contents,
$encoding), 1
);
} // If no BOM, check for fallback encoding. Per CSS spec the regex is very strict.
elseif (preg_match('/^@charset "([^"]+)";/',
$contents,
$matches)) { if ($matches[1
] !== 'utf-8' &&
$matches[1
] !== 'UTF-8'
) { $contents =
substr($contents,
strlen($matches[0
]));
$contents = Unicode::
convertToUtf8($contents,
$matches[1
]);
} } // Return the processed stylesheet.
$content =
$this->
processCss($contents,
$_optimize);
} // Restore the parent base path as the file and its children are processed.
$basepath =
$parent_base_path;
return $content;
} /**
* Loads stylesheets recursively and returns contents with corrected paths.
*
* This function is used for recursive loading of stylesheets and
* returns the stylesheet content with all url() paths corrected.
*
* @param array $matches
* An array of matches by a preg_replace_callback() call that scans for
* @import-ed CSS files, except for external CSS files.
*
* @return string
* The contents of the CSS file at $matches[1], with corrected paths.
*
* @see \Drupal\Core\Asset\AssetOptimizerInterface::loadFile()
*/