Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make possibility pass build directory #1272

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/cms/twig/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ public function themeFilter($url): string
/**
* Generates Vite tags via Laravel's Vite Object.
*/
public function viteFunction(array $entrypoints, string $package): \Illuminate\Support\HtmlString
public function viteFunction(array $entrypoints, string $package, ?string $buildDirectory = null): \Illuminate\Support\HtmlString
{
return Vite::tags($entrypoints, $package);
return Vite::tags($entrypoints, $package, $buildDirectory);
}

/**
Expand Down
11 changes: 7 additions & 4 deletions modules/system/classes/asset/Vite.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ class Vite extends LaravelVite
*
* @param string|array $entrypoints The list of entry points for Vite
* @param string|null $package The package name of the plugin or theme
* @param string|null $buildDirectory The Vite build directory
*
* @return HtmlString
*
* @throws SystemException
*/
public function __invoke($entrypoints, $package = null)
public function __invoke($entrypoints, $package = null, $buildDirectory = null)
{
if (!$package) {
throw new \InvalidArgumentException('A package must be passed');
Expand All @@ -32,19 +34,20 @@ public function __invoke($entrypoints, $package = null)
}

$this->useHotFile(base_path($compilableAssetPackage['path'] . '/assets/dist/hot'));
return parent::__invoke($entrypoints, $compilableAssetPackage['path'] . '/assets/dist');
return parent::__invoke($entrypoints, $compilableAssetPackage['path'] . ($buildDirectory ?? '/assets/dist'));
}

/**
* Helper method to generate Vite tags for an entrypoint(s).
*
* @param string|array $entrypoints The list of entry points for Vite
* @param string $package The package name of the plugin or theme
* @param string|null $buildDirectory The Vite build directory
*
* @throws SystemException
*/
public static function tags(array|string $entrypoints, string $package): HtmlString
public static function tags(array|string $entrypoints, string $package, ?string $buildDirectory = null): HtmlString
{
return App::make(\Illuminate\Foundation\Vite::class)($entrypoints, $package);
return App::make(\Illuminate\Foundation\Vite::class)($entrypoints, $package, $buildDirectory);
}
}
Loading