class CssOptimizer in Flysystem 2.0.x
Same name and namespace in other branches
- 8 src/Asset/CssOptimizer.php \Drupal\flysystem\Asset\CssOptimizer
- 3.x src/Asset/CssOptimizer.php \Drupal\flysystem\Asset\CssOptimizer
- 3.0.x src/Asset/CssOptimizer.php \Drupal\flysystem\Asset\CssOptimizer
Changes Drupal\Core\Asset\CssOptimizer to not remove absolute URLs.
@codeCoverageIgnore
Hierarchy
- class \Drupal\Core\Asset\CssOptimizer implements AssetOptimizerInterface
- class \Drupal\flysystem\Asset\CssOptimizer
Expanded class hierarchy of CssOptimizer
1 file declares its use of CssOptimizer
- FlysystemServiceProviderTest.php in tests/
src/ Unit/ FlysystemServiceProviderTest.php
File
- src/
Asset/ CssOptimizer.php, line 12
Namespace
Drupal\flysystem\AssetView source
class CssOptimizer extends DrupalCssOptimizer {
/**
* {@inheritdoc}
*/
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);
}
// file_url_transform_relative() was removed here.
return 'url(' . file_create_url($path) . ')';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CssOptimizer:: |
protected | property | The file URL generator. | |
CssOptimizer:: |
public | property | The base path used by rewriteFileURI(). | |
CssOptimizer:: |
public | function |
Processes the contents of a CSS asset for cleanup. Overrides AssetOptimizerInterface:: |
|
CssOptimizer:: |
private | function | Returns the file URL generator. | |
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. | |
CssOptimizer:: |
public | function |
Prefixes all paths within a CSS file for processFile(). Overrides CssOptimizer:: |
|
CssOptimizer:: |
public | function | Constructs a CssOptimizer. |