Skip to content

Instantly share code, notes, and snippets.

@wilsenhc
Last active September 23, 2022 03:52
Show Gist options
  • Save wilsenhc/f40dad2245449714983bb304bf725d3b to your computer and use it in GitHub Desktop.
Save wilsenhc/f40dad2245449714983bb304bf725d3b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title inertia>{{ config('app.name', 'Laravel') }}</title>
<!-- Scripts -->
@routes
{{ App\Facades\GlobalVite::withEntryPoints(['resources/js/app.ts']) }}
@inertiaHead
</head>
<body class="antialiased">
@inertia
</body>
</html>
<?php
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
/**
* Global Vite Facade
*
* @method static string useCspNonce(?string $nonce = null)
* @method static string|null cspNonce()
* @method static string asset(string $asset, string|null $buildDirectory)
* @method static string hotFile()
* @method static \App\Helpers\GlobalVite useBuildDirectory(string $path)
* @method static \App\Helpers\GlobalVite useHotFile(string $path)
* @method static \App\Helpers\GlobalVite useIntegrityKey(string|false $key)
* @method static \App\Helpers\GlobalVite useScriptTagAttributes(callable|array $callback)
* @method static \App\Helpers\GlobalVite useStyleTagAttributes(callable|array $callback)
* @method static \App\Helpers\GlobalVite withEntryPoints(array $entryPoints)
*
* @see \App\Helpers\GlobalViteHelper
*/
class GlobalViteFacade extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return \App\Helpers\GlobalViteHelper::class;
}
}
<?php
namespace App\Helpers;
use Illuminate\Foundation\Vite;
class GlobalViteHelper extends Vite
{
/**
* Generate an asset path for the application.
*
* @param string $path
* @param bool|null $secure
* @return string
*/
protected function assetPath($path, $secure = null)
{
return global_asset($path);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment