Skip to content

Commit de80ce6

Browse files
authored
[9.x] Add Vite asset path generation method (#44037)
1 parent 88f8b02 commit de80ce6

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/Illuminate/Foundation/Vite.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function __invoke($entrypoints, $buildDirectory = null)
219219

220220
$tags->push($this->makeTagForChunk(
221221
$partialManifest->keys()->first(),
222-
asset("{$buildDirectory}/{$css}"),
222+
$this->assetPath("{$buildDirectory}/{$css}"),
223223
$partialManifest->first(),
224224
$manifest
225225
));
@@ -228,7 +228,7 @@ public function __invoke($entrypoints, $buildDirectory = null)
228228

229229
$tags->push($this->makeTagForChunk(
230230
$entrypoint,
231-
asset("{$buildDirectory}/{$chunk['file']}"),
231+
$this->assetPath("{$buildDirectory}/{$chunk['file']}"),
232232
$chunk,
233233
$manifest
234234
));
@@ -238,7 +238,7 @@ public function __invoke($entrypoints, $buildDirectory = null)
238238

239239
$tags->push($this->makeTagForChunk(
240240
$partialManifest->keys()->first(),
241-
asset("{$buildDirectory}/{$css}"),
241+
$this->assetPath("{$buildDirectory}/{$css}"),
242242
$partialManifest->first(),
243243
$manifest
244244
));
@@ -487,7 +487,19 @@ public function asset($asset, $buildDirectory = null)
487487

488488
$chunk = $this->chunk($this->manifest($buildDirectory), $asset);
489489

490-
return asset($buildDirectory.'/'.$chunk['file']);
490+
return $this->assetPath($buildDirectory.'/'.$chunk['file']);
491+
}
492+
493+
/**
494+
* Generate an asset path for the application.
495+
*
496+
* @param string $path
497+
* @param bool|null $secure
498+
* @return string
499+
*/
500+
protected function assetPath($path, $secure = null)
501+
{
502+
return asset($path, $secure);
491503
}
492504

493505
/**

0 commit comments

Comments
 (0)