protected function CssOptimizer::processFile
protected CssOptimizer::processFile($css_asset)
Build aggregate CSS file.
File
- core/lib/Drupal/Core/Asset/CssOptimizer.php, line 53
Class
- CssOptimizer
- Optimizes a CSS asset.
Namespace
Drupal\Core\AssetCode
protected function processFile($css_asset) { $contents = $this->loadFile($css_asset['data'], TRUE); $contents = $this->clean($contents); // Get the parent directory of this file, relative to the Drupal root. $css_base_path = substr($css_asset['data'], 0, strrpos($css_asset['data'], '/')); // Store base path. $this->rewriteFileURIBasePath = $css_base_path . '/'; // Anchor all paths in the CSS with its base URL, ignoring external and absolute paths. return preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\s*\)/i', array($this, 'rewriteFileURI'), $contents); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Asset!CssOptimizer.php/function/CssOptimizer::processFile/8.1.x