diff --git a/docs/assets/js/color-modes.js b/docs/assets/js/color-modes.js index f14a3be9d5..19d45cc7c6 100644 --- a/docs/assets/js/color-modes.js +++ b/docs/assets/js/color-modes.js @@ -1,6 +1,6 @@ /*! * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/) - * Copyright 2011-2023 The Bootstrap Authors + * Copyright 2011-2024 The Bootstrap Authors * Licensed under the Creative Commons Attribution 3.0 Unported License. */ @@ -35,19 +35,20 @@ } const themeSwitcherText = document.querySelector('#bd-theme-text') - const activeThemeIcon = document.querySelector('.theme-icon-active use') - const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`) - const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href') + const activeThemeIcon = document.querySelector('.theme-icon-active') + const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"] i`) + const initialIconOfActiveBtn = [...btnToActive.classList].find(cl => cl.startsWith('bi-')) - document.querySelectorAll('[data-bs-theme-value]').forEach(element => { + for (const element of document.querySelectorAll('[data-bs-theme-value]')) { element.classList.remove('active') element.setAttribute('aria-pressed', 'false') - }) + } btnToActive.classList.add('active') btnToActive.setAttribute('aria-pressed', 'true') - activeThemeIcon.setAttribute('href', svgOfActiveBtn) - const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})` + const currentIconOfActiveBtn = [...activeThemeIcon.classList].find(cl => cl.startsWith('bi-')) + activeThemeIcon.classList.replace(currentIconOfActiveBtn, initialIconOfActiveBtn) + const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.parentElement.dataset.bsThemeValue})` themeSwitcher.setAttribute('aria-label', themeSwitcherLabel) if (focus) { @@ -65,15 +66,14 @@ window.addEventListener('DOMContentLoaded', () => { showActiveTheme(getPreferredTheme()) - document.querySelectorAll('[data-bs-theme-value]') - .forEach(toggle => { - toggle.addEventListener('click', () => { - const theme = toggle.getAttribute('data-bs-theme-value') - localStorage.setItem('theme', theme) - setStoredTheme(theme) - setTheme(theme) - showActiveTheme(theme, true) - }) + for (const toggle of document.querySelectorAll('[data-bs-theme-value]')) { + toggle.addEventListener('click', () => { + const theme = toggle.getAttribute('data-bs-theme-value') + localStorage.setItem('theme', theme) + setStoredTheme(theme) + setTheme(theme) + showActiveTheme(theme, true) }) + } }) })() diff --git a/docs/content/_index.md b/docs/content/_index.md index 0976b40dba..5108bcb55f 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -35,7 +35,7 @@ composer require twbs/bootstrap-icons Include the icon fonts stylesheet—in your website `` or via `@import` in CSS—from jsDelivr and get started in seconds. [See icon font docs](#icon-font) for examples. {{< highlight html >}} - + {{< /highlight >}} {{< highlight css >}} diff --git a/docs/layouts/partials/favicons.html b/docs/layouts/partials/favicons.html index 520b61a127..58fd96db51 100644 --- a/docs/layouts/partials/favicons.html +++ b/docs/layouts/partials/favicons.html @@ -1,4 +1,3 @@ -{{ "" | safeHTML }} diff --git a/docs/layouts/partials/footer.html b/docs/layouts/partials/footer.html index e340df5b1f..8ec9af27f7 100644 --- a/docs/layouts/partials/footer.html +++ b/docs/layouts/partials/footer.html @@ -2,13 +2,14 @@
- + {{ partial "icons/bootstrap-white-fill.svg" (dict "class" "d-block me-2" "width" "40" "height" "32") }} Bootstrap
@@ -20,7 +21,7 @@
Links
  • Icons
  • Themes
  • Blog
  • -
  • Swag Store
  • +
  • Swag Store
  • diff --git a/docs/layouts/partials/icons/github.svg b/docs/layouts/partials/icons/github.svg deleted file mode 100644 index 6f06f7722b..0000000000 --- a/docs/layouts/partials/icons/github.svg +++ /dev/null @@ -1 +0,0 @@ -{{ with .title }}{{ . }}{{ else }}GitHub{{ end }} \ No newline at end of file diff --git a/docs/layouts/partials/icons/opencollective.svg b/docs/layouts/partials/icons/opencollective.svg deleted file mode 100644 index 2896ba50ce..0000000000 --- a/docs/layouts/partials/icons/opencollective.svg +++ /dev/null @@ -1 +0,0 @@ -{{ with .title }}{{ . }}{{ else }}Open Collective{{ end }} \ No newline at end of file diff --git a/docs/layouts/partials/icons/twitter.svg b/docs/layouts/partials/icons/twitter.svg deleted file mode 100644 index 7a7fcee28b..0000000000 --- a/docs/layouts/partials/icons/twitter.svg +++ /dev/null @@ -1 +0,0 @@ -{{ with .title }}{{ . }}{{ else }}Twitter{{ end }} \ No newline at end of file diff --git a/docs/layouts/partials/navbar.html b/docs/layouts/partials/navbar.html index 7b7a152567..18dffc21bc 100644 --- a/docs/layouts/partials/navbar.html +++ b/docs/layouts/partials/navbar.html @@ -10,7 +10,7 @@ -
    + diff --git a/docs/layouts/partials/social.html b/docs/layouts/partials/social.html index 8e734dabd9..e1bb75a111 100644 --- a/docs/layouts/partials/social.html +++ b/docs/layouts/partials/social.html @@ -1,17 +1,21 @@ -{{ "" | safeHTML }} +{{- $pageTitle := .Title | default .Site.Title | markdownify -}} +{{- $pageDescription := .Page.Params.description | default .Site.Params.description | markdownify -}} +{{- $socialImagePath := .Site.Params.social_image_path -}} + - - - + + + -{{ "" | safeHTML }} - - + + - + - - +{{ with (imageConfig (path.Join "docs/static" $socialImagePath)) -}} + + +{{- end }} diff --git a/docs/layouts/partials/stylesheet.html b/docs/layouts/partials/stylesheet.html index 2502e1b5e1..d9b3233192 100644 --- a/docs/layouts/partials/stylesheet.html +++ b/docs/layouts/partials/stylesheet.html @@ -1,4 +1,4 @@ - + {{- $sassOptions := dict "targetPath" "assets/css/docs.css" "precision" 6 -}} {{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}} @@ -9,4 +9,4 @@ {{- $style := resources.Get "scss/docs.scss" | toCSS $sassOptions | postCSS $postcssOptions -}} - + diff --git a/package.json b/package.json index 8b90c9dc74..1136e6cf43 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,8 @@ }, "scripts": { "start": "npm run docs-serve", - "docs-serve": "hugo server --port 4000 --disableFastRender", - "docs-build": "hugo --cleanDestinationDir --printUnusedTemplates", + "docs-serve": "hugo server --port 4000 --disableFastRender --noHTTPCache --renderToMemory --printPathWarnings --printUnusedTemplates", + "docs-build": "hugo --cleanDestinationDir --printPathWarnings --printUnusedTemplates", "docs-test": "npm-run-all docs-build docs-test:vnu", "docs-test:vnu": "node build/vnu-jar.mjs", "pages": "node build/build-pages.mjs",