45 \
Magento\Framework\Filesystem $appFilesystem,
47 \
Magento\Framework\View\Asset\Repository $assetRepo
50 $this->filesystem = $appFilesystem;
51 $this->appState = $appState;
52 $this->assetRepo = $assetRepo;
62 $relPath = $this->config->getConfigFileRelativePath();
63 $this->ensureSourceFile($relPath);
64 return $this->assetRepo->createArbitrary($relPath,
'');
74 $relPath = $this->config->getMinResolverRelativePath();
75 $this->ensureMinResolverFile($relPath);
76 return $this->assetRepo->createArbitrary($relPath,
'');
86 return $this->assetRepo->createArbitrary($this->config->getMixinsFileRelativePath(),
'');
96 return $this->assetRepo->createArbitrary($this->config->getRequireJsFileRelativePath(),
'');
106 return $this->assetRepo->createArbitrary($this->config->getUrlResolverFileRelativePath(),
'');
116 if ($this->checkIfExist($this->config->getMapFileRelativePath())) {
117 return $this->assetRepo->createArbitrary($this->config->getMapFileRelativePath(),
'');
131 private function ensureSourceFile($relPath)
134 if ($this->appState->getMode() == AppState::MODE_DEVELOPER || !$dir->isExist($relPath)) {
135 $dir->writeFile($relPath, $this->config->getConfig());
145 private function ensureMinResolverFile($relPath)
148 if ($this->appState->getMode() == AppState::MODE_DEVELOPER || !$dir->isExist($relPath)) {
149 $dir->writeFile($relPath, $this->config->getMinResolverCode());
160 if ($this->appState->getMode() != AppState::MODE_PRODUCTION) {
171 public function createBundleJsPool()
174 if ($this->appState->getMode() == AppState::MODE_PRODUCTION) {
177 $context = $this->assetRepo->getStaticViewFileContext();
181 if (!$libDir->isExist($bundleDir)) {
185 foreach ($libDir->read($bundleDir) as $bundleFile) {
186 if (pathinfo($bundleFile, PATHINFO_EXTENSION) !==
'js') {
189 $relPath = $libDir->getRelativePath($bundleFile);
190 $bundles[] = $this->assetRepo->createArbitrary($relPath,
'');
203 public function clearBundleJsPool()
207 $context = $this->assetRepo->getStaticViewFileContext();
209 return $dirWrite->delete($bundleDir);
218 private function checkIfExist($relPath)
221 return $dir->isExist($relPath);
createRequireJsMixinsAsset()
__construct(Config $config, \Magento\Framework\Filesystem $appFilesystem, AppState $appState, \Magento\Framework\View\Asset\Repository $assetRepo)
createRequireJsConfigAsset()
createRequireJsMapConfigAsset()