Skip to content

Commit 2816764

Browse files
sashas777mageprince
authored andcommitted
Issue #11354 Merged CSS file name generation
1 parent 6178786 commit 2816764

File tree

1 file changed

+13
-0
lines changed
  • lib/internal/Magento/Framework/View/Asset

1 file changed

+13
-0
lines changed

lib/internal/Magento/Framework/View/Asset/Merged.php

100644100755
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ class Merged implements \Iterator
4040
*/
4141
protected $contentType;
4242

43+
/**
44+
* @var StorageInterface
45+
*/
46+
private $versionStorage;
47+
4348
/**
4449
* @var bool
4550
*/
@@ -56,11 +61,13 @@ public function __construct(
5661
\Psr\Log\LoggerInterface $logger,
5762
MergeStrategyInterface $mergeStrategy,
5863
\Magento\Framework\View\Asset\Repository $assetRepo,
64+
\Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage,
5965
array $assets
6066
) {
6167
$this->logger = $logger;
6268
$this->mergeStrategy = $mergeStrategy;
6369
$this->assetRepo = $assetRepo;
70+
$this->versionStorage = $versionStorage;
6471

6572
if (!$assets) {
6673
throw new \InvalidArgumentException('At least one asset has to be passed for merging.');
@@ -116,6 +123,12 @@ private function createMergedAsset(array $assets)
116123
$paths[] = $asset->getPath();
117124
}
118125
$paths = array_unique($paths);
126+
127+
$version=$this->versionStorage->load();
128+
if ($version) {
129+
$paths[]=$version;
130+
}
131+
119132
$filePath = md5(implode('|', $paths)) . '.' . $this->contentType;
120133
return $this->assetRepo->createArbitrary($filePath, self::getRelativeDir());
121134
}

0 commit comments

Comments
 (0)