Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function merge(array $assetsToMerge, \Magento\Framework\View\Asset\LocalInterface $resultAsset)
 {
     $dir = $this->filesystem->getDirectoryRead(\Magento\Framework\App\Filesystem::STATIC_VIEW_DIR);
     if (!$dir->isExist($resultAsset->getPath())) {
         $this->strategy->merge($assetsToMerge, $resultAsset);
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function merge(array $assetsToMerge, \Magento\Framework\View\Asset\LocalInterface $resultAsset)
 {
     $sourceDir = $this->filesystem->getDirectoryRead(DirectoryList::ROOT);
     $mTime = null;
     /** @var \Magento\Framework\View\Asset\MergeableInterface $asset */
     foreach ($assetsToMerge as $asset) {
         $mTime .= $sourceDir->stat($sourceDir->getRelativePath($asset->getSourceFile()))['mtime'];
     }
     if (null === $mTime) {
         return;
         // nothing to merge
     }
     $dat = $resultAsset->getPath() . '.dat';
     $targetDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
     if (!$targetDir->isExist($dat) || strcmp($mTime, $targetDir->readFile($dat)) !== 0) {
         $this->strategy->merge($assetsToMerge, $resultAsset);
         $targetDir->writeFile($dat, $mTime);
     }
 }