src/Task/OptimizeCssTask.php
private function convertRelativePaths($css, $fullPathName)
  {
    // Note: URLs like url(test/test(1).jpg) i.e. URL with ( or ) in name, or not supported.

    // The pcre.backtrack_limit option can trigger a NULL return, with no errors. To prevent we reach this limit we
    // split the CSS into an array of lines.
    $lines = explode("\n", $css);

    $lines = preg_replace_callback('/(url\([\'"]?)(([^()]|(?R))+)([\'"]?\))/i',
      function ($matches) use ($fullPathName) {
        return $matches[1].Url::combine($this->getPathInResources($fullPathName), $matches[2]).$matches[4];
      },
                                   $lines);

    if ($lines===null)
    {
      $this->logError("Converting relative paths failed for '%s'", $fullPathName);
    }

    return implode("\n", $lines);
  }
private function convertRelativePaths($css, $fullPathName)
  {
    // Note: URLs like url(test/test(1).jpg) i.e. URL with ( or ) in name, or not supported.

    // The pcre.backtrack_limit option can trigger a NULL return, with no errors. To prevent we reach this limit we
    // split the CSS into an array of lines.
    $lines = explode("\n", $css);

    $lines = preg_replace_callback('/(url\([\'"]?)(([^()]|(?R))+)([\'"]?\))/i',
      function ($matches) use ($fullPathName) {
        return $matches[1].Url::combine($this->getPathInResources($fullPathName), $matches[2]).$matches[4];
      },
                                   $lines);

    if ($lines===null)
    {
      $this->logError("Converting relative paths failed for '%s'", $fullPathName);
    }

    return implode("\n", $lines);
  }
private function convertRelativePaths ( $ css , $ fullPathName ) { // Note: URLs like url(test/test(1).jpg) i.e. URL with ( or ) in name, or not supported. // The pcre.backtrack_limit option can trigger a NULL return, with no errors. To prevent we reach this limit we // split the CSS into an array of lines. $ lines = explode ( "\n" , $ css ) ; $ lines = preg_replace_callback ( '/(url\([\'"]?)(([^()]|(?R))+)([\'"]?\))/i' , function ( $ matches ) use ( $ fullPathName ) { return $ matches [ 1 ] . Url :: combine ( $ this -> getPathInResources ( $ fullPathName ) , $ matches [ 2 ] ) . $ matches [ 4 ] ; } , $ lines ) ; if ( $ lines === null ) { $ this -> logError ( "Converting relative paths failed for '%s'" , $ fullPathName ) ; } return implode ( "\n" , $ lines ) ; }
In CSS code replace relative paths with absolute paths.

@param string $css          The CSS code.
@param string $fullPathName The full pathname of the CSS file.

@return string The modified CSS code.
In CSS code replace relative paths with absolute paths .