X-Git-Url: https://git.rapsys.eu/packbundle/blobdiff_plain/de79190e6f2bb667c2ab9ad3d94815c20f218ba8..HEAD:/Package/PathPackage.php?ds=inline diff --git a/Package/PathPackage.php b/Package/PathPackage.php index c202b19..d5b4b6f 100644 --- a/Package/PathPackage.php +++ b/Package/PathPackage.php @@ -11,12 +11,12 @@ namespace Rapsys\PackBundle\Package; +use Rapsys\PackBundle\Context\NullContext; + use Symfony\Component\Asset\Context\ContextInterface; use Symfony\Component\Asset\Package; use Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface; -use Rapsys\PackBundle\Context\NullContext; - /** * {@inheritdoc} */ @@ -57,20 +57,20 @@ class PathPackage extends Package { } /** + * {@inheritdoc} + * * Returns an absolute or root-relative public path * - * Transform @BundleBundle to bundle and remove /Resources/public fragment from path + * Transform @BundleBundle to bundle and remove [/Resources|]/public fragment from path * This bundle name conversion and bundle prefix are the same as in asset:install command * * @link https://symfony.com/doc/current/bundles.html#overridding-the-bundle-directory-structure * @see vendor/symfony/framework-bundle/Command/AssetsInstallCommand.php +113 * @see vendor/symfony/framework-bundle/Command/AssetsInstallCommand.php +141 - * - * {@inheritdoc} */ public function getUrl(string $path): string { //Match url starting with a bundle name - if (preg_match('%^@([A-Z][a-zA-Z]*?)(?:Bundle/Resources/public)?/(.*)$%', $path, $matches)) { + if (preg_match('%^@([A-Z][a-zA-Z]*?)(?:Bundle/(?:Resources/)?public)?/(.*)$%', $path, $matches)) { //Handle empty or without replacement pattern basePath if (empty($this->basePath) || strpos($this->basePath, '%s') === false) { //Set path from hardcoded format