vite-styles.blade.php 465 B

1234567891011121314151617
  1. @php
  2. $manifestPath = public_path('build/manifest.json');
  3. @endphp
  4. @if (file_exists($manifestPath))
  5. @vite(['resources/css/app.css'])
  6. @else
  7. @php
  8. $cssFiles = glob(public_path('build/assets/app-*.css')) ?: [];
  9. usort($cssFiles, fn ($a, $b) => filemtime($b) <=> filemtime($a));
  10. $css = $cssFiles[0] ?? null;
  11. @endphp
  12. @if ($css)
  13. <link rel="stylesheet" href="{{ str_replace(public_path(), '', $css) }}">
  14. @endif
  15. @endif