class S3fsCssOptimizer in S3 File System 8.2
Optimizes a CSS asset.
Hierarchy
- class \Drupal\Core\Asset\CssOptimizer implements AssetOptimizerInterface
- class \Drupal\s3fs\S3fsCssOptimizer
Expanded class hierarchy of S3fsCssOptimizer
File
- src/
S3fsCssOptimizer.php, line 10
Namespace
Drupal\s3fsView source
class S3fsCssOptimizer extends CssOptimizer {
/**
* Return absolute urls to access static files that they aren't in S3 bucket.
*
* @param array $matches
* An array of matches by a preg_replace_callback() call that scans for
* url() references in CSS files, except for external or absolute ones.
*
* @return string
* The file path.
*/
public function rewriteFileURI($matches) {
// Prefix with base and remove '../' segments where possible.
$path = $this->rewriteFileURIBasePath . $matches[1];
$last = '';
while ($path != $last) {
$last = $path;
$path = preg_replace('`(^|/)(?!\\.\\./)([^/]+)/\\.\\./`', '$1', $path);
}
return 'url(' . file_create_url($path) . ')';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CssOptimizer:: |
public | property | The base path used by rewriteFileURI(). | |
CssOptimizer:: |
public | function |
Processes the contents of a CSS asset for cleanup. Overrides AssetOptimizerInterface:: |
|
CssOptimizer:: |
public | function | Loads the stylesheet and resolves all @import commands. | |
CssOptimizer:: |
protected | function | Loads stylesheets recursively and returns contents with corrected paths. | |
CssOptimizer:: |
public | function |
Optimizes an asset. Overrides AssetOptimizerInterface:: |
|
CssOptimizer:: |
protected | function | Processes the contents of a stylesheet for aggregation. | |
CssOptimizer:: |
protected | function | Build aggregate CSS file. | |
S3fsCssOptimizer:: |
public | function |
Return absolute urls to access static files that they aren't in S3 bucket. Overrides CssOptimizer:: |