getPublicFilesystemPath example

return $manifestData[$logicalPath];
        }

        $asset = $this->getAsset($logicalPath);

        return $asset?->publicPath;
    }

    private function loadManifest(): array
    {
        if (null === $this->manifestData) {
            $path = $this->assetsPathResolver->getPublicFilesystemPath().'/'.self::MANIFEST_FILE_NAME;

            if (!is_file($path)) {
                $this->manifestData = [];
            } else {
                $this->manifestData = json_decode(file_get_contents($path), true);
            }
        }

        return $this->manifestData;
    }
}
$this->assertSame('/assets-prefix/foo/bar', $resolver->resolvePublicPath('/foo/bar'));
        $this->assertSame('/assets-prefix/foo/bar', $resolver->resolvePublicPath('foo/bar'));
    }

    public function testGetPublicFilesystemPath()
    {
        $resolver = new PublicAssetsPathResolver(
            '/path/to/projectRootDir/',
            '/assets-prefix',
            'publicDirName',
        );
        $this->assertSame('/path/to/projectRootDir/publicDirName/assets-prefix', $resolver->getPublicFilesystemPath());

        $resolver = new PublicAssetsPathResolver(
            '/path/to/projectRootDir',
            '/assets-prefix/',
            'publicDirName',
        );
        $this->assertSame('/path/to/projectRootDir/publicDirName/assets-prefix', $resolver->getPublicFilesystemPath());
    }
}


        return $matches;
    }

    private function buildImportMapJson(): void
    {
        if (isset($this->json)) {
            return;
        }

        $dumpedImportMapPath = $this->assetsPathResolver->getPublicFilesystemPath().'/'.self::IMPORT_MAP_FILE_NAME;
        $dumpedModulePreloadPath = $this->assetsPathResolver->getPublicFilesystemPath().'/'.self::IMPORT_MAP_PRELOAD_FILE_NAME;
        if (is_file($dumpedImportMapPath) && is_file($dumpedModulePreloadPath)) {
            $this->json = file_get_contents($dumpedImportMapPath);
            $this->modulesToPreload = json_decode(file_get_contents($dumpedModulePreloadPath), true, 512, \JSON_THROW_ON_ERROR);

            return;
        }

        $entries = $this->loadImportMapEntries();
        $this->modulesToPreload = [];

        

    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new SymfonyStyle($input$output);
        $publicDir = $this->projectDir.'/'.$this->publicDirName;
        if (!is_dir($publicDir)) {
            throw new InvalidArgumentException(sprintf('The public directory "%s" does not exist.', $publicDir));
        }

        $outputDir = $this->publicAssetsPathResolver->getPublicFilesystemPath();
        if ($input->getOption('clean')) {
            $io->comment(sprintf('Cleaning <info>%s</info>', $outputDir));
            $this->filesystem->remove($outputDir);
            $this->filesystem->mkdir($outputDir);
        }

        $manifestPath = $outputDir.'/'.AssetMapper::MANIFEST_FILE_NAME;
        if (is_file($manifestPath)) {
            $this->filesystem->remove($manifestPath);
        }
        $manifest = $this->createManifestAndWriteFiles($io$publicDir);
        
Home | Imprint | This part of the site doesn't use cookies.