Skip to content

Commit

Permalink
Issue magento#11354 Merged CSS file name generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sashas777 committed Jun 27, 2018
1 parent ce48579 commit bf019e2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/internal/Magento/Framework/View/Asset/Merged.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class Merged implements \Iterator
*/
protected $contentType;

/**
* @var StorageInterface
*/
private $versionStorage;

/**
* @var bool
*/
Expand All @@ -56,11 +61,13 @@ public function __construct(
\Psr\Log\LoggerInterface $logger,
MergeStrategyInterface $mergeStrategy,
\Magento\Framework\View\Asset\Repository $assetRepo,
\Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage,
array $assets
) {
$this->logger = $logger;
$this->mergeStrategy = $mergeStrategy;
$this->assetRepo = $assetRepo;
$this->versionStorage = $versionStorage;

if (!$assets) {
throw new \InvalidArgumentException('At least one asset has to be passed for merging.');
Expand Down Expand Up @@ -116,6 +123,12 @@ private function createMergedAsset(array $assets)
$paths[] = $asset->getPath();
}
$paths = array_unique($paths);

$version=$this->versionStorage->load();
if ($version) {
$paths[]=$version;
}

$filePath = md5(implode('|', $paths)) . '.' . $this->contentType;
return $this->assetRepo->createArbitrary($filePath, self::getRelativeDir());
}
Expand Down

0 comments on commit bf019e2

Please sign in to comment.