]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Docs: fix Bootstrap bundle loading consistency between dev and static builds v6-dev-fix-bootstrap-bundle-docs-loading 42237/head
authorJulien Déramond <juderamond@gmail.com>
Mon, 23 Mar 2026 21:33:03 +0000 (22:33 +0100)
committerJulien Déramond <juderamond@gmail.com>
Mon, 23 Mar 2026 21:33:03 +0000 (22:33 +0100)
eslint.config.js
site/src/assets/bootstrap.bundle.js [new file with mode: 0644]
site/src/components/Scripts.astro
site/src/libs/bootstrap.ts

index 32196fc1764b18a36bca428a9b2ac6421cdeca82..b72a134ebcc0a4f5eaf9ff22dcc9f67a96b53ea4 100644 (file)
@@ -274,6 +274,7 @@ export default [
   {
     files: [
       'site/src/assets/application.js',
+      'site/src/assets/bootstrap.bundle.js',
       'site/src/assets/partials/*.js',
       'site/src/assets/search.js',
       'site/src/assets/snippets.js',
diff --git a/site/src/assets/bootstrap.bundle.js b/site/src/assets/bootstrap.bundle.js
new file mode 100644 (file)
index 0000000..f21f382
--- /dev/null
@@ -0,0 +1,3 @@
+import * as bootstrapBundle from '../../../dist/js/bootstrap.bundle.js'
+
+Object.keys(bootstrapBundle)
index 3ce53e2c4fec428bfb5202d3c17faa534ec6aca8..a4f3064b94d0f67adca3df12c9acffb0b6d9861a 100644 (file)
@@ -1,4 +1,5 @@
 ---
+import { getVersionedBsJsProps } from '@libs/bootstrap'
 import type { Layout } from '@libs/layout'
 import DocsScripts from './DocsScripts.astro'
 
@@ -9,6 +10,8 @@ interface Props {
 const { layout } = Astro.props
 ---
 
+<script is:inline {...getVersionedBsJsProps()}></script>
+
 <script src="../assets/application.js"></script>
 <script src="../assets/search.js"></script>
 
index 3b033895480a3aec5583f554925b536af6833076..c07e5962e16f1eb600ff9f98143e4378e576d87d 100644 (file)
@@ -26,6 +26,13 @@ export function getVersionedBsCssProps(direction: 'rtl' | undefined) {
 export function getVersionedBsJsProps() {
   let bsJsScriptSrc = '/dist/js/bootstrap.bundle'
 
+  if (import.meta.env.DEV) {
+    return {
+      type: 'module',
+      src: '/src/assets/bootstrap.bundle.js'
+    } satisfies HTMLAttributes<'script'>
+  }
+
   if (import.meta.env.PROD) {
     bsJsScriptSrc = `${bsJsScriptSrc}.min`
   }