]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Docs: fix theme selector on direct load (Cheatsheet/Sidebars examples) (#42382)
authorJulien Déramond <juderamond@gmail.com>
Fri, 1 May 2026 17:28:06 +0000 (19:28 +0200)
committerGitHub <noreply@github.com>
Fri, 1 May 2026 17:28:06 +0000 (19:28 +0200)
site/src/assets/examples/cheatsheet/cheatsheet.js
site/src/assets/examples/sidebars/sidebars.js
site/src/layouts/ExamplesLayout.astro

index 422eb23943d8de5d1047a955aacf897a1241894c..9529872d61bd4a5db2ac53733857325df8f64df1 100644 (file)
@@ -1,4 +1,4 @@
-import { Tooltip, Popover, Toast } from '../../dist/js/bootstrap.bundle.js'
+import { Tooltip, Popover, Toast } from '@bootstrap'
 
 document.querySelectorAll('.tooltip-demo')
   .forEach(tooltip => {
index 6b3177aa433e7696727331a9ce2e559eb1262a58..4784568783b7debdcb8b3cd17ffa787eed370c3d 100644 (file)
@@ -1,4 +1,4 @@
-import { Tooltip } from '../../dist/js/bootstrap.bundle.js'
+import { Tooltip } from '@bootstrap'
 
 const tooltipTriggerList = [...document.querySelectorAll('[data-bs-toggle="tooltip"]')]
 tooltipTriggerList.forEach(tooltipTriggerEl => {
index 4a232df09c9a3e8a33c46a0a4439bfeaf9954db1..9e13fab228cdd8dc733e918000836cda7356f5e3 100644 (file)
@@ -15,6 +15,12 @@ const { body_class, extra_css, extra_js, html_class, include_js, title = 'Exampl
 
 const pageTitle = `${title} · ${getConfig().title} v${getConfig().docs_version}`
 const canonicalUrl = new URL(Astro.url.pathname, Astro.site)
+const bootstrapJsProps = getVersionedBsJsProps()
+const importMap = JSON.stringify({
+  imports: {
+    '@bootstrap': bootstrapJsProps.src
+  }
+})
 ---
 
 <!doctype html>
@@ -121,7 +127,8 @@ const canonicalUrl = new URL(Astro.url.pathname, Astro.site)
     {
       include_js !== false && (
         <Fragment>
-          <script is:inline {...getVersionedBsJsProps()} />
+          <script type="importmap" is:inline set:html={importMap} />
+          <script is:inline {...bootstrapJsProps} />
           {extra_js?.map((js) => (
             <script
               is:inline