public function VendorStreamWrapperAssetOptimizer::optimize in Vendor Stream Wrapper 8
Optimizes an asset.
Parameters
array $asset: An asset.
Return value
string The optimized asset's contents.
Overrides AssetOptimizerInterface::optimize
File
- src/
Asset/ VendorStreamWrapperAssetOptimizer.php, line 40
Class
- VendorStreamWrapperAssetOptimizer
- Decorates the CSS and JS optimization services.
Namespace
Drupal\vendor_stream_wrapper\AssetCode
public function optimize(array $asset) {
// Translate the virtual 'vendor_files' paths into the correct path for the
// vendor directory, so that the actual file can loaded by the optimization
// service.
if (!empty($asset['data']) && strpos($asset['data'], 'vendor_files/') === 0) {
$asset['data'] = str_replace('vendor_files', VendorStreamWrapper::basePath(), $asset['data']);
}
return $this->innerService
->optimize($asset);
}