diff --git a/apps/client/src/index.ts b/apps/client/src/index.ts index 32f08fd3a..df5c6a853 100644 --- a/apps/client/src/index.ts +++ b/apps/client/src/index.ts @@ -1,9 +1,16 @@ +import $ from "jquery"; + async function bootstrap() { + (window as any).$ = $; + (window as any).jQuery = $; + await setupGlob(); + await loadBootstrapCss(); loadStylesheets(); loadIcons(); setBodyAttributes(); await loadScripts(); + hideSplash(); } async function setupGlob() { @@ -17,6 +24,15 @@ async function setupGlob() { }; } +async function loadBootstrapCss() { + // We have to selectively import Bootstrap CSS based on text direction. + if (document.body.dir === "rtl") { + await import("bootstrap/dist/css/bootstrap.rtl.min.css"); + } else { + await import("bootstrap/dist/css/bootstrap.min.css"); + } +} + function loadStylesheets() { const { assetPath, themeCssUrl, themeUseNextAsBase } = window.glob; const cssToLoad: string[] = []; @@ -70,7 +86,6 @@ function setBodyAttributes() { } async function loadScripts() { - await import("./runtime.js"); if (glob.device === "mobile") { await import("./mobile.js"); } else { @@ -78,4 +93,8 @@ async function loadScripts() { } } +function hideSplash() { + $("body").show(); +} + bootstrap(); diff --git a/apps/client/src/runtime.ts b/apps/client/src/runtime.ts deleted file mode 100644 index 4c82481b1..000000000 --- a/apps/client/src/runtime.ts +++ /dev/null @@ -1,15 +0,0 @@ -import $ from "jquery"; - -async function loadBootstrap() { - if (document.body.dir === "rtl") { - await import("bootstrap/dist/css/bootstrap.rtl.min.css"); - } else { - await import("bootstrap/dist/css/bootstrap.min.css"); - } -} - -(window as any).$ = $; -(window as any).jQuery = $; -await loadBootstrap(); - -$("body").show(); diff --git a/apps/client/vite.config.mts b/apps/client/vite.config.mts index 09f44950e..b4298563d 100644 --- a/apps/client/vite.config.mts +++ b/apps/client/vite.config.mts @@ -74,7 +74,6 @@ export default defineConfig(() => ({ login: join(__dirname, "src", "login.ts"), setup: join(__dirname, "src", "setup.ts"), set_password: join(__dirname, "src", "set_password.ts"), - runtime: join(__dirname, "src", "runtime.ts"), print: join(__dirname, "src", "print.tsx") }, output: {