diff --git a/resources/themes/backend/views/layouts/auth/simple.blade.php b/resources/themes/backend/views/layouts/auth/simple.blade.php
old mode 100755
new mode 100644
index 1c6ae02..2dbb914
--- a/resources/themes/backend/views/layouts/auth/simple.blade.php
+++ b/resources/themes/backend/views/layouts/auth/simple.blade.php
@@ -1,7 +1,7 @@
- @include('partials.head')
+ @include('partials.head', ['loadModuleAssets' => false, 'loadLayoutAssets' => false])
diff --git a/resources/themes/backend/views/layouts/auth/split.blade.php b/resources/themes/backend/views/layouts/auth/split.blade.php
old mode 100755
new mode 100644
index f8dcce9..0cfd6a5
--- a/resources/themes/backend/views/layouts/auth/split.blade.php
+++ b/resources/themes/backend/views/layouts/auth/split.blade.php
@@ -1,7 +1,7 @@
- @include('partials.head')
+ @include('partials.head', ['loadModuleAssets' => false, 'loadLayoutAssets' => false])
diff --git a/resources/themes/backend/views/partials/head.blade.php b/resources/themes/backend/views/partials/head.blade.php
old mode 100755
new mode 100644
index 6b9330a..2a8b8de
--- a/resources/themes/backend/views/partials/head.blade.php
+++ b/resources/themes/backend/views/partials/head.blade.php
@@ -11,35 +11,43 @@
{{ filled($title ?? null) ? $title.' - '.config('app.name', 'Laravel') : config('app.name', 'Laravel') }}
@fonts
@php
+ // Guest/authentication pages only need the shared theme stylesheet. Loading
+ // every enabled module here made /login download each module's CSS/JS even
+ // though none of those assets are used on the authentication screen.
+ $loadModuleAssets = $loadModuleAssets ?? auth()->check();
+ $loadLayoutAssets = $loadLayoutAssets ?? auth()->check();
+
$backendCssEntry = is_file(resource_path('themes/backend/assets/css/app.css'))
? 'resources/themes/backend/assets/css/app.css'
: 'resources/themes/backend/assets/css/helpdesk.css';
- $viteAssets = [
- $backendCssEntry,
- 'resources/themes/backend/assets/js/passkeys.js',
- 'resources/themes/backend/assets/js/layout.js',
- ];
+ $viteAssets = [$backendCssEntry];
- $moduleStatuses = [];
- $moduleStatusFile = base_path('modules_statuses.json');
-
- if (is_file($moduleStatusFile)) {
- $moduleStatuses = json_decode((string) file_get_contents($moduleStatusFile), true) ?: [];
+ if ($loadLayoutAssets) {
+ $viteAssets[] = 'resources/themes/backend/assets/js/layout.js';
}
- foreach (glob(base_path('Modules/*'), GLOB_ONLYDIR) ?: [] as $moduleDirectory) {
- $moduleName = basename($moduleDirectory);
+ if ($loadModuleAssets) {
+ $moduleStatuses = [];
+ $moduleStatusFile = base_path('modules_statuses.json');
- if (array_key_exists($moduleName, $moduleStatuses) && ! $moduleStatuses[$moduleName]) {
- continue;
+ if (is_file($moduleStatusFile)) {
+ $moduleStatuses = json_decode((string) file_get_contents($moduleStatusFile), true) ?: [];
}
- foreach (['Resources/assets/css/app.css', 'Resources/assets/js/app.js'] as $entry) {
- $absoluteEntry = $moduleDirectory.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $entry);
+ foreach (glob(base_path('Modules/*'), GLOB_ONLYDIR) ?: [] as $moduleDirectory) {
+ $moduleName = basename($moduleDirectory);
- if (is_file($absoluteEntry)) {
- $viteAssets[] = str_replace('\\', '/', substr($absoluteEntry, strlen(base_path()) + 1));
+ if (array_key_exists($moduleName, $moduleStatuses) && ! $moduleStatuses[$moduleName]) {
+ continue;
+ }
+
+ foreach (['Resources/assets/css/app.css', 'Resources/assets/js/app.js'] as $entry) {
+ $absoluteEntry = $moduleDirectory.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $entry);
+
+ if (is_file($absoluteEntry)) {
+ $viteAssets[] = str_replace('\\', '/', substr($absoluteEntry, strlen(base_path()) + 1));
+ }
}
}
}